Prime Number Generator
Generate every prime number between two numbers, or the first N primes, with the count, sum, smallest and largest prime and a list you can copy.
This generator lists prime numbers — whole numbers greater than 1 whose only divisors are 1 and themselves. Ask for every prime in a range, such as 1 to 100 or the last million numbers below one trillion, or for the first N primes. You get the count, the smallest and largest prime found, their sum, and a comma-separated list ready to copy.
How to use this tool
- Choose a range, or "the first N primes".
- For a range, enter the start and end; both ends are included.
- For the first N primes, enter N.
- Copy the list from the results box, or read it in rows of ten in the table.
Formula
Sieve of Eratosthenes: for each prime p ≤ √(end), cross out p², p² + p, p² + 2p, … — every number left is prime.
Only primes up to the square root of the end are needed, because every composite number n has a factor no larger than √n. For ranges that start high, the generator runs a segmented sieve: it sieves only the numbers you asked about, using those small primes, so it avoids allocating every integer below a high starting point; preparing the base primes still adds work. For the first N primes it sieves up to N(ln N + ln ln N), a bound that is proven to exceed the Nth prime for N ≥ 6.
Example
From 1 to 100 there are 25 primes: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89 and 97. The smallest is 2, the largest is 97, and together they add up to 1,060.
Frequently asked questions
Is 1 a prime number?
No. A prime has exactly two different divisors, and 1 has only one. Ranges that start at 0 or 1 therefore begin with 2, the only even prime.
How many primes are there below 1,000 or 1,000,000?
There are 168 primes below 1,000 and 78,498 below 1,000,000. The prime number theorem says the count up to x is roughly x ÷ ln x, so primes thin out slowly as numbers grow.
What is the 100th or the 1,000th prime?
The 100th prime is 541 and the 1,000th is 7,919. Choose "the first N primes" with N = 100 or 1000 to see the whole list.
Why is the range limited?
Everything runs in your browser. Capping a request at 10 million numbers keeps the page responsive; split bigger jobs into several ranges.
Last updated: 2026-10-30