Skip to main content
18 events
when toggle format what by license comment
Nov 11, 2021 at 9:18 comment added vitaly-t It slows down quite a bit after 1e11. If you need something faster in the high range, you can find an attached archive in this discussion with such faster solution.
Nov 11, 2021 at 8:43 comment added vitaly-t @RiyazMansoor It is at the bottom of the benchmarks.
Nov 11, 2021 at 7:36 comment added Riyaz Mansoor was wondering how long it takes to count upto 1e12 this is for a project that requires to resolve multiple range counts upto 1e12.
Oct 25, 2021 at 5:25 history edited vitaly-t CC BY-SA 4.0
deleted 7 characters in body
Oct 25, 2021 at 4:50 history edited vitaly-t CC BY-SA 4.0
deleted 7 characters in body
Oct 25, 2021 at 4:44 history edited vitaly-t CC BY-SA 4.0
deleted 1165 characters in body
Oct 22, 2021 at 14:20 comment added vitaly-t @Mwr247 See the update I added - it doesn't use countPrimesApprox, and so no pre-generated primes at all. The performance drops by 2%, compared to the one that does use countPrimesApprox, that's all :)
S Oct 22, 2021 at 14:19 review First answers
Oct 22, 2021 at 14:26
S Oct 22, 2021 at 14:19 history edited vitaly-t CC BY-SA 4.0
added 989 characters in body
Oct 22, 2021 at 14:04 comment added vitaly-t @Mwr247 You are referring to function countPrimesApprox, which isn't even needed there, I added it for a tiny performance improvement, because every little helps. We can just remove it, and use const primes = [] instead, and do return {primes: new Uint32Array(primes), pi}; in the end. And that's it, it will work the same, just appr. 5% slower. I didn't want to change the code to pass all requirements because the competition is long over anyway.
Oct 22, 2021 at 13:50 comment added Mwr247 Impressive, though as is unfortunately it violates challenge rules 3 and 4: "Built-ins that test primality or generate primes are not allowed. This includes lists of primes, which may not be looked up externally or hardcoded locally, except with regards to the next bullet point." & "You may hardcode primes up to and including 19 and no higher." Your countPrimesApprox makes use of a hardcoded prime list up to 593, so that'll needs a different approach. Well done no less though.
Oct 22, 2021 at 8:49 history edited vitaly-t CC BY-SA 4.0
added 8 characters in body
Oct 22, 2021 at 8:34 history edited vitaly-t CC BY-SA 4.0
added 2 characters in body
Oct 22, 2021 at 8:26 history edited vitaly-t CC BY-SA 4.0
added 8 characters in body
Oct 22, 2021 at 8:18 history edited vitaly-t CC BY-SA 4.0
added 12 characters in body
Oct 22, 2021 at 8:10 history edited vitaly-t CC BY-SA 4.0
deleted 10 characters in body
S Oct 22, 2021 at 8:05 review First answers
Oct 22, 2021 at 8:52
S Oct 22, 2021 at 8:05 history answered vitaly-t CC BY-SA 4.0