Maths - Prime Number List Generator



This page allows you to generate a list of Prime Numbers, as a series. You may choose between a numbered list, or an unformatted sequence of results. Both will have exactly the same entries. Please note that this task requires a lot of memory to run. The actual computation is carried out indirectly: a list of non-prime numbers is produced by generating a set of multiplication tables from the known primes (there is no need to list multiples of the non-prime numbers) and then cross-checking each integer in sequence to see if it exists in the non-prime list.
Click on any of the links at the top of the page to reveal (or hide) more information about this calculator.


This technique works relatively quickly for small to medium sized lists, but is not very efficient for calculating single, large Prime numbers, for which a number of formulae exist. As the Prime numbers get larger, the length of both lists get longer, and the average size of the contents also increases, meaning that if the list of Primes gets ten times longer, the amount of storage (computer memory) required gets approximately fifty times larger. For instance; on a Macintosh Powerbook G4 1.1GHz laptop with 1GB of RAM, (running FireFox on OSX 10.5 Leopard) a list of the Prime numbers smaller than 75,000 was generated in about twenty hours. To reach 86,000 took another four days, and required 4GB of virtual memory. Incidentally, the same test using FireFox 3 on a Windows XP Pro machine with 1GB of RAM crashed when the list reached approximately 45,000. Due to a limitation in Javascript, numbers larger than about 2,000,000,000 need to be displayed in 'Scientific Notation' or 'Exponential Notation' as it is sometimes known, so even if your PC has enough memory to calculate lists that large, the results will no longer be useful beyond that point.
If you are reading this paragraph, then you probably don't have JavaScript installed/enabled on your computer.
At this point in time the calculators on this site are entirely dependent on JavaScript. Given enough time and money it is hoped to develop a version in the future which will be able to operate independently. Since JavaScript runs on your own computer, rather than on this server, it has been possible to set up this site much more quickly than if a server-side language was used, and it is possible to serve far more pages with the available bandwidth.
If you think that you can assist with this project in any way, then please visit the Support section and leave a message.


A prime number is an integer that cannot be divided exactly by any integer other than itself or one.
Zero, one, two and three are all special cases, due to their small size. Zero is never considered Prime. One and Two are both too small to possibly be divided by any other integer. By convention, One is generally NOT considered Prime, whereas Two generally is, making it the only even Prime number. Three is therefore the first non-controversial Prime, but in order to provide maximum compatibility, this list always uses Two as the first Prime number in the generated sequence.


There are many, usually complex, formulae to test whether an integer is Prime, however this list does not depend on any of these, instead relying on an exclusion list.


If you change the 'Number of entries to generate' box, after a list has been generated, the original list will be expanded from where it previously finished.
If you have a very old computer, and choose to calculate a long list, the system may become temporarily unresponsive. If this proves problematic, choose a small number first, then increase gradually. Only new values will be created each time.


© Copyright Mike Brockington 2004 - 2021   All Rights Reserved