[Community Puzzle] Bailey–Borwein–Plouffe Pi

https://www.codingame.com/training/hard/baileyborweinplouffe-pi

Send your feedback or ask for help here!

Created by @Zenoscave,validated by @pardouin,@P.Greze and @Astrobytes.
If you have any issues, feel free to ping them.

Is it possible to solve this puzzle with JavaScript, does anyone managed to do it?

I’ve optimised the code so it passes all tests, but when I submit it still fails on tests 4 and 6 which I suppose are digit positions over 30k after the dot.

[Moderator edit: image link expired]

I converted my solution (from python) and it passes in javascript. It did involve a bit of optimisation due to javascripts issues with integers (if you have a similar algorithm doing a right bit shift instead of a divide by 2 made a massive difference).

Those two validators do involve digits much later in the sequence than anything in the testcases so I’ve added a new testcase of a large value to prevent the issue where you pass all tests and then fail for performance.

1 Like

Sorry, Just seeing this! Thanks for the information with issues on JS, I suppose TS would have similar issues? Should we check that as well?