I wrote this little software that generates as many prime numbers as you want. That’s all it does. Using this software, you can determine the nth prime number, where n can be very, very large. The first version of the software can generate up to around 1014 primes. I have since improved it to remove this limitation. I don’t actually know what is the limitation now, but I’ve tried generating 1034 prime numbers and the program still works! Note though that I haven’t actually let the software generates that many prime numbers. Doing so will take lots of time!


This software doesn’t use any particular mathematical formula to generate the prime numbers. Instead, it checks every single odd number by dividing it with another odd number from 3 to see if that number is divisible without a remainder. As such, the prime numbers it generates is guaranteed to be a prime number, every single one of them.


I have optimised the algorithm to minimise the software’s processing time, and at current version it is able to generate up to the hundred-thousandth prime numbers and write it to file in just about 1 second on a 2.1GHz dual-core Windows Vista machine.

You have to bear in mind, however, that in order to know what’s the ten-millionth prime number, for example, the software needs to determine all the other 9,999,999 prime numbers that precede that ten-millionth prime. That’s a lot of calculations and iterations to be done, even for a computer.


View of the program when it is run

Generating the prime numbers

Finished generating the prime numbers and writing them to file


As with all the other contents of this website, this software is licensed under this particular Creative Commons Licence. You are free to share – to copy, distribute, and transmit the software – as long as you attribute the software to me. You may not use the software for commercial purposes. However, I do grant anybody the right to alter, transform, or build upon this software.

Source Code

This software is written in C. Contact me if you want a copy of the source code.


I do not take responsibility for any loss or damage that results from the usage of this software. No warranty, expressed or implied, is provided with this software.


Click on the appropriate link below to download the software. I assure you the file is virus-free, but as a precaution, you might still want to run a virus check on it using any antivirus software you like, in case the file is tempered with without my knowledge.

Windows: Prime Number Generator (1157 downloads)

For the technical: MD5 – 94aeb4699bec57617c7a9c312e51a7e5