2 ms·
Although python does have from sympy import primepi primepi(1e6) which returns instantly.
by contravariant 6y ago
Although python does have
from sympy import primepi
primepi(1e6)
which returns instantly.
- joshka 6y agoThis is the real answer, although the algorithm used seems to use a sieve rather than a naive check for (x & i == 0) https://github.com/sympy/sympy/blob/219993505f88a8d6f825db1deaad939a28cbb78c/sympy/ntheory/generate.py#L417-L528 https://github.com/sympy/sympy/blob/219993505f88a8d6f825db1d...
- igouy 6y agoNo, this is the real answer: https://web.archive.org/web/20010606131022/http://www.bagley.org/~doug/shootout/bench/sieve/ https://web.archive.org/web/20010606131022/http://www.bagley...