Nth Prime Number Calculator
Look up the exact prime at any spot in line from 1 to 10,000, explore mathematical boundary fences, or enter any prime to find its place in the sequence.
Guaranteed Fences: Dusart's Boundary Window
In 1999, French mathematician Pierre Dusart proved something remarkable: for every prime after the 5th prime (n ≥ 6), the exact prime number is guaranteed to fall safely between two easy-to-calculate boundaries:
Notice how the exact prime always sits safely between the lower and upper fences.
Reverse Lookup: Find a Prime's Place in Line
Already have a prime number and want to know what place it holds in line? Type any prime number below to see its exact sequence position:
Euler's 40-Prime Streak: x² + x + 41
In 1772, mathematician Leonhard Euler discovered that the simple formula x² + x + 41 churns out 40 prime numbers in a row for whole numbers x = 0 through 39! Slide the bar to watch the streak in action, and see what happens when it finally hits a composite number at 40:
Famous Prime Milestones
Click any milestone card to immediately inspect its place in line and exact prime number:
Step Forward and Backward in Line
Quickly step through the prime sequence by jumping 1, 5, or 10 spots at a time:
How Fast Do Primes Grow? Comparing Estimates
As you move further down the number line, prime numbers spread out. The Prime Number Theorem shows that the prime at spot n is roughly n × ln(n). Use this slider to see how close this estimate gets to the exact prime as n increases:
Notice that as n gets larger, the ratio heads closer and closer toward 1.000, and the exact prime is always slightly larger than n × ln(n).
Landmark Primes Quick Reference Table
The table below lists famous milestone spots in line, comparing the exact prime with mathematical boundary estimates. Click any row to test it in the calculator above:
| Spot n | Exact Prime | Rough Estimate | Lower Fence | Upper Fence | Accuracy Ratio | Gap to Prior Prime |
|---|---|---|---|---|---|---|
| 1 | 2 | 0 | — | — | — | — |
| 2 | 3 | 1.39 | — | — | 2.164 | 1 |
| 5 | 11 | 8.05 | — | — | 1.367 | 4 |
| 10 | 29 | 23.03 | 21.39 | 31.39 | 1.259 | 6 |
| 25 | 97 | 80.47 | 84.66 | 109.66 | 1.205 | 8 |
| 50 | 229 | 195.60 | 213.98 | 263.98 | 1.171 | 2 |
| 100 | 541 | 460.52 | 513.31 | 613.31 | 1.175 | 18 |
| 168 | 997 | 860.81 | 967.65 | 1,135.65 | 1.158 | 6 |
| 500 | 3,571 | 3,107.30 | 3,517.92 | 4,017.92 | 1.149 | 12 |
| 1,000 | 7,919 | 6,907.76 | 7,841.15 | 8,841.15 | 1.146 | 22 |
| 10,000 | 104,729 | 92,103.40 | 104,310.82 | 114,310.82 | 1.137 | 6 |
How Mathematicians Predict the Nth Prime
Understanding where the Nth prime lands is one of the classic puzzles in mathematics. While there is no direct shortcut formula, primes follow very steady and predictable patterns.
The Prime Number Theorem tells us that as numbers grow, the prime at spot n gets closer and closer to n × ln(n):
This also shows that the average gap before the Nth prime is roughly ln(prime).
Rosser's Rule & Dusart's Refinement
In 1939, mathematician J. Barkley Rosser proved a helpful fact:
This means the basic formula n × ln(n) always under-estimates the real prime! In 1999, Pierre Dusart added an upper boundary to lock the answer between two tight fences:
Step-by-Step Worked Walkthroughs
Here are four examples showing how to find primes by position and how to look up a prime's place in line:
Find the 25th Prime (n = 25)
- Rough Estimate: 25 × ln(25) ≈ 25 × 3.22 = 80.5.
- Dusart Boundaries: Lower = 84.7, Upper = 109.7.
- Count primes up to 100: Exactly 25 primes exist (2, 3, 5, 7, ..., 89, 97).
- Result: The 25th prime is 97. It sits safely inside the predicted fence.
Find the 100th Prime (n = 100)
- Rough Estimate: 100 × ln(100) ≈ 100 × 4.61 = 460.5.
- Dusart Boundaries: Lower = 513.3, Upper = 613.3.
- Count primes up through 550: The 100th prime integer is reached at 541.
- Result: The 100th prime is 541.
Find the 1,000th Prime (n = 1,000)
- Rough Estimate: 1,000 × ln(1,000) ≈ 6,908.
- Dusart Boundaries: Lower = 7,841, Upper = 8,841.
- Exact lookup: The 1,000th prime number is 7,919.
- The prime right before it is 7,883, leaving a gap of 36.
- Result: The 1,000th prime is 7,919.
Find the Rank of 104,729
- Check if it is prime: Yes, 104,729 has no divisors other than 1 and itself.
- Count how many primes come before or at 104,729.
- Counting all primes up to 104,729 gives exactly 10,000.
- Result: 104,729 is the 10,000th prime number.
Where Prime Positions Are Used in Everyday Tech
Knowing where primes sit in line is surprisingly important in computers and digital security:
Random Number Generators
Computer programs use specific prime positions as starter "seeds" to create random numbers that never repeat or overlap.
Lightning-Fast Chips
Security hardware chips store the first 1,000 primes in permanent fast memory so they can test numbers in fractions of a billionth of a second.
Supercomputer Searches
When researchers want to find the 1-trillionth prime, they use counting formulas to zero in on the number directly without having to list billions of primes.
How Computers Find the Nth Prime: 4 Methods Compared
Here is how four common computer methods compare when searching for prime position n:
| Method | Calculation Speed | Memory Needed | Best Used Up To | How It Works |
|---|---|---|---|---|
| Testing One by One | Slowest | Tiny (few bytes) | n ≤ 10,000 | Tests each odd number until the prime counter reaches n |
| Standard Sieve Grid | Very Fast | Medium (megabytes) | n ≤ 10 million | Creates a giant checklist in memory and crosses out multiples |
| Block-by-Block Sieve | Very Fast | Low (fits chip cache) | n ≤ 100 billion | Processes small chunks at a time so memory never fills up |
| Shortcut Formula Inversion | Fastest for Huge n | Moderate | n ≥ 1 quintillion | Uses math formulas to count primes without listing them |
Related Prime Discovery Tools
Frequently Asked Questions
What does 'Nth prime number' mean?
The prime numbers form an endless line in counting order: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, and so on. Think of it like a line of runners: 2 is 1st in line, 3 is 2nd, 5 is 3rd, and so on. The 'Nth prime' is whichever prime sits at position number N. For example, the 1st prime is 2, the 25th prime is 97, and the 100th prime is 541.
Is there an easy formula to calculate the Nth prime directly?
There is no simple plug-and-play formula that lets you instantly jump to the Nth prime without checking or counting numbers along the way. However, mathematicians like Pierre Dusart discovered reliable boundary formulas that guarantee the exact prime always sits between two easy-to-calculate fences.
What is the 10,000th prime number?
The 10,000th prime number is 104,729. All prime numbers up to position 10,000 are saved directly in your browser for instant results.
Why can't I enter 0 as a position?
Because positions start with 1 (1st, 2nd, 3rd, etc.). There is no '0th' prime, just like there is no 0th place on a race podium.
Can I enter a prime number to find its place in line (reverse lookup)?
Yes! Use our reverse lookup tool below. Enter any prime number (like 97) to see what place it holds in line (97 is the 25th prime).
What is Euler's famous prime streak formula x² + x + 41?
In 1772, mathematician Leonhard Euler discovered a surprising formula: x² + x + 41. If you plug in whole numbers from 0 up to 39, every single answer turns out to be prime! It finally breaks at x = 40, which gives 40² + 40 + 41 = 1,681 (which is 41 × 41).