Prime Number Generator & N-th Prime Calculator

Generate all prime numbers in any custom range up to 1,000,000 using the Sieve of Eratosthenes, look up the N-th prime (up to the 100,000th), filter twin primes, or create random primes with instant CSV/JSON download.

Found 95 primes between 1 and 500
2357111317192329313741434753596167717379838997101103107109113127131137139149151157163167173179181191193197199211223227229233239241251257263269271277281283293307311313317331337347349353359367373379383389397401409419421431433439443449457461463467479487491499

Famous N-th Prime Number Milestones

Quick lookup table for popular N-th prime values computed via the Sieve of Eratosthenes.

Rank (N) N-th Prime (pₙ)
#1 2
#10 29
#25 97
#50 229
#100 541
#168 997
#500 3,571
#1,000 7,919
#10,000 104,729
#100,000 1,299,709

Prime Counting Function π(x) up to 1,000,000

Exact count of prime numbers less than or equal to each power of 10, alongside the fraction of integers that are prime.

Upper Bound (x) Primes ≤ x (π(x)) Prime Density
10 4 40.00%
100 25 25.00%
1,000 168 16.80%
10,000 1,229 12.29%
100,000 9,592 9.59%
1,000,000 78,498 7.85%

Sieve of Eratosthenes vs. Miller-Rabin Primality Test

When you need every prime up to a bound N (such as 1,000,000), the Sieve of Eratosthenes runs in O(N log log N) time by iteratively crossing off multiples of each prime starting from p².

When you instead need a single random 18-digit prime (or want to test a 100-digit integer), sieving is impossible. Instead, this tool uses the deterministic Miller-Rabin primality test over BigInt modular exponentiation, finishing in under a millisecond.

Frequently Asked Questions

What is the 100th prime number?

The 100th prime number is 541. The 1,000th prime number is 7,919, and the 10,000th prime number is 104,729.

How many prime numbers are below 1,000,000?

There are exactly 78,498 prime numbers less than 1,000,000 (approximately 7.85% of integers in that range).

How fast is the Sieve of Eratosthenes in the browser?

Using a compact typed byte array (Uint8Array), sieving all 78,498 primes up to 1,000,000 takes roughly 10 milliseconds entirely client-side with zero server requests.

Can I export the generated prime list for Python, Excel, or JavaScript?

Yes — click CSV to open directly in Excel or pandas, or click JSON to copy/download an array ready for JavaScript, Python, or Go.

Prime Number Tools & Reference Guides

Explore dedicated charts, visual factor trees, range generators, and step-by-step proofs for commonly searched numbers.