What is a prime number generator?
A prime number generator lists prime numbers for you. Ask for the first 10 primes and it gives you 2, 3, 5, 7, 11, 13, 17, 19, 23 and 29. Ask for the first 5 and it gives you 2, 3, 5, 7 and 11. The list is always the same for the same count, because primes are fixed facts of arithmetic, not random draws.
Teachers use these lists for factor tables, worksheets and tests. Programmers use them for hash tables, test data and cryptography exercises. Students use them to check their own work: if your list of the first 10 primes does not match this one, one of your numbers is wrong, and the mismatch points straight at it.
This generator takes one input — how many primes you want, from 1 to 100 — and shows the list, the count, and the largest prime in the list. Press the button and the list appears. Nothing is uploaded and there is no sign-up.
How a prime number generator works
The generator works by trial division, the same test the prime checker uses. It starts at 2, tests whether 2 is prime, keeps it, then moves to 3, tests it, keeps it, then 4, tests it, rejects it, and so on. Each candidate is divided by 2, 3, 4 and the rest up to its square root. The first divisor found rejects the candidate; a candidate with no divisor is prime and joins the list.
The generator stops as soon as it has collected as many primes as you asked for. For the default count of 10, it stops at 29, the 10th prime. For a count of 5 it stops at 11. The largest prime shown is simply the last number collected, which is why the largest prime for 10 primes is 29.
A faster method for big lists is the Sieve of Eratosthenes, which crosses out multiples instead of testing each number separately. It is faster for thousands of primes, but trial division is simpler to follow and instant for the first 100 primes, so this page uses trial division and the result is identical either way.
The first primes, and why 2 is special
The list always starts with 2, the only even prime and the smallest prime of all. After 2 comes 3, then 5, then 7, then 11. Every prime after 2 is odd, because every even number above 2 is divisible by 2. That single fact cuts the work in half: once 2 is in the list, only odd candidates need testing.
The gaps between primes grow as the numbers get bigger, but not smoothly. The first 10 primes run from 2 to 29, a span of 27. The first 25 primes run from 2 to 97, a span of 95. The 100th prime is 541. If you generate 100 primes, the largest is 541, and the list will contain every prime below it with none missing.
The number 1 never appears in the list. It is not prime, because it has only one divisor. If 1 were counted as prime, every list would start with 1 and the fundamental theorem of arithmetic would break, since each number would have many prime factorisations instead of one.
A worked example: the first 10, 5 and 1 primes
The default on this page is 10 primes. The generator tests 2, keeps it; tests 3, keeps it; tests 4, rejects it because 2 divides it; tests 5, keeps it; and carries on until it has kept 10 numbers. The list is 2, 3, 5, 7, 11, 13, 17, 19, 23, 29. The count is 10 and the largest prime is 29.
Ask for 5 primes and the list stops earlier: 2, 3, 5, 7, 11. The count is 5 and the largest prime is 11. Ask for just 1 prime and the answer is a list of one number, 2, with a count of 1 and a largest prime of 2. These small cases are the easiest way to check the generator is doing what you expect.
Ask for 25 primes and the list ends at 97, the 25th prime. The count is 25 and the largest is 97. That is a handy cross-check with the prime checker: type 97 into the prime number checker and it confirms 97 is prime, with exactly 2 divisors.
Where prime lists actually get used
In school, prime lists are the raw material for factor trees, lowest common multiples and highest common factors. A student factoring 60 looks down the prime list — 2, 3, 5 — and finds 60 is 2 times 2 times 3 times 5. Without the list, the same job means guessing divisors one at a time. A GCD calculator and a LCM calculator both use prime factors under the surface.
In computing, prime-sized hash tables spread data more evenly, and prime numbers seed random generators and test data. Cryptography goes further: RSA encryption multiplies two huge primes, and the security of the system rests on how hard it is to split the product back apart. The primes in real RSA keys are hundreds of digits long, but the idea is the same list, scaled up.
In puzzles and contests, prime lists settle questions fast. Is 91 prime? It is not in the first 25 primes, and 91 is 7 times 13. Which primes sit between 50 and 100? The list gives 53, 59, 61, 67, 71, 73, 79, 83, 89 and 97. A factorial calculator pairs well here, since factorials and primes both grow out of the same whole-number arithmetic.
Prime number generator vs prime number checker
The generator and the checker are two sides of the same test. The checker takes one number and returns a verdict: prime or not, with its smallest factor and divisor count. The generator takes a count and returns a list of that many primes. Use the checker for a single suspect number and the generator for a list.
If you are unsure whether a number in a generated list is really prime, check it with the prime number checker. Type 29 and it returns Prime, with 29 as its own smallest factor and 2 divisors. The two tools agree because they run the same trial-division test, just in opposite directions.
For lists longer than 100 primes, a sieve-based tool is faster, but the maths does not change: the 100th prime is 541 and the 1,000th prime is 7,919. This page caps at 100 primes so the list stays readable on a phone screen, which covers every school list and most programming test data.
Common prime list mistakes
The most common mistake is starting the list at 1. The first prime is 2, not 1. A list that starts 1, 2, 3, 5, 7 is wrong from the first entry, and everything built on it — factor trees, GCD work, test answers — inherits the error.
The second mistake is including 9, 15, 21 or 25. All four are odd, and all four are composite: 9 is 3 times 3, 15 is 3 times 5, 21 is 3 times 7, and 25 is 5 times 5. Odd does not mean prime, and the only way to be sure is to test divisors up to the square root.
The third mistake is skipping a prime in the middle of a long list. The primes between 80 and 100 are 83, 89 and 97, and 91 is the usual trap — it is 7 times 13, so it is not prime. Generating the list with a tool instead of writing it from memory removes this whole class of error.
How to use this prime number generator
Type how many primes you want into the box. The default is 10, which gives 2, 3, 5, 7, 11, 13, 17, 19, 23, 29. Press Generate Primes and the list appears in the box below, with the count and the largest prime shown above it.
To make a longer list, raise the count to 25 or 50 and press the button again. The list is deterministic: the same count always gives the same primes, so you can copy it into a worksheet or a program and trust it. The largest prime row tells you where the list ends — for 10 primes it is 29, for 25 it is 97, and for 100 it is 541.
Everything runs in your browser. No account, no upload, no data sent anywhere. Pair it with the scientific calculator when a problem needs primes plus other arithmetic, and with the prime checker when you want to verify a single number from the list.