Nth Prime Number Calculator

Calculate indexed primes with fast validation and insights. See nearby primes, gaps, estimates, and charts. Download clean outputs for classwork, audits, publishing, and practice.

Calculator Form

Example: 100 returns the 100th prime, which is 541.
More samples create a richer chart.
Choose display precision for the estimate line.
Compare true values with the asymptotic estimate.

Example Data Table

n Nth Prime Previous Prime Next Prime Prime Gap After Nth
1 2 N/A 3 1
5 11 7 13 2
10 29 23 31 2
25 97 89 101 4
100 541 523 547 6
1000 7919 7907 7927 8

Formula Used

Exact search: The calculator finds primes with a sieve. It marks composite numbers, keeps primes, and stops once the nth prime is reached.

Upper bound for search: For n ≥ 6, a practical bound is:

pn < n(ln n + ln ln n)

Approximation for comparison: The chart and estimate card use:

pn ≈ n(ln n + ln ln n - 1)

Prime gap: The reported gap is:

gap = next prime - nth prime

How to Use This Calculator

  1. Enter the target index n.
  2. Choose how many points you want in the graph.
  3. Set the estimate precision you want displayed.
  4. Select whether the graph should show actual primes only or also include the estimate line.
  5. Press Calculate Prime.
  6. Review the exact prime, nearby primes, prime gap, estimate accuracy, and graph.
  7. Use the CSV or PDF button to export the report.

Frequently Asked Questions

1) What does the nth prime number mean?

The nth prime is the prime that appears in position n within the ordered list of prime numbers. For example, the 1st prime is 2, the 2nd is 3, and the 10th is 29.

2) Why does the calculator use a sieve?

A sieve is efficient for finding many primes in order. It removes composite numbers in bulk, which is usually faster than testing each number separately for primality.

3) Is the displayed nth prime exact or estimated?

The nth prime result is exact. The estimate shown beside it is only a comparison value from a logarithmic approximation formula.

4) Why does the estimate differ from the exact answer?

The estimate comes from asymptotic number theory. It becomes more useful as n grows, but it is still an approximation, so some difference is expected.

5) What is the prime gap shown in results?

The prime gap is the distance from the nth prime to the next prime. It helps show how prime spacing changes as numbers get larger.

6) Is there a practical input limit?

Yes. This page limits n to 100000 so the calculation stays responsive on common hosting plans and classroom servers.

7) What does the chart represent?

The chart plots prime index on the horizontal axis and prime value on the vertical axis. It lets you compare actual growth with the approximation line.

8) When should I export CSV or PDF?

Use CSV when you want spreadsheet analysis or recordkeeping. Use PDF when you want a clean printable report for notes, homework, or client documentation.

Related Calculators

quadratic equation to standard form calculatorx method factoring calculatorangle to decimal calculatordivide evenly calculatorpartial quotient calculatorimproper fraction to decimal calculatorslope intercept to standard form calculatorDigital Root CalculatorLong Addition Calculatorarea of uneven square calculator

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.