Hacker News new | past | comments | ask | show | jobs | submit
There is also the segmented Sieve of Eratosthenes. It has a simlar performance but uses much less memory: the number of prime numbers from 2 to sqrt(n). For example, for n = 1000000, the RAM has to store only 168 additional numbers.

I use this algorithm here https://surenenfiajyan.github.io/prime-explorer/

loading story #47388910
Yep, this is the natural way to go, especially considering the possibility of parallel computing and the importance of cache locality, etc.