Discussion
Generating All 32-Bit Primes (Part I)
logicallee: there are also very fast primality tests that work statistically.
ZyanWu: > There is a long way to go from here. Kim Walisch's primesieve can generate all 32-bit primes in 0.061s (though this is without writing them to a file)Oh, come on, just use a bash indirection and be done with it. It takes 1 minute and you had another result for comparison
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/
forinti: If you take all 53 8 bit primes, you can use modular arithmetic to work with numbers up to64266330917908644872330635228106713310880186591609208114244758680898150367880703152525200743234420230This would require 334 bits.