Comment Comment by senfiaj 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/ parent senfiaj 8 months ago
I use this algorithm here https://surenenfiajyan.github.io/prime-explorer/