- Generating a hundred million primes
- I just want the file!
Generating a hundred million primes
I did not reinvent the wheel and simply used the code from this StackOverflow answer and included it in a script. It’s a smart Eratosthene Sieve
The script uses Python 3.6 but it can easily be adapted to older versions. Beware of the string formating and
To generate a million primes:
$ python generate_primes.py --n=1000000 --outf='./1e6_primes.txt'
I suggest you have a look at the PrimeSieve project -> primesieve.org they have a highly optimized C++ implementation and its associated Python bindings.
I just want the file!
Here you go.