Skip to content
ENExplore Calculators

Nth Prime Number Calculator

Work out nth prime number instantly with clear inputs, formula shown and shareable results.

About Nth Prime Number Calculator

The primes are generated with the sieve of Eratosthenes, sized using the estimate pₙ ≈ n(ln n + ln ln n) so the sieve is guaranteed to be large enough.

Formula

Prime counting estimate

pₙ ≈ n(ln n + ln ln n)

Worked example

With the default values below, Nth Prime Number Calculator returns The nth prime of 541. Change any input above and every figure here is recalculated in your browser.

Inputs used

Which prime (n)accepts 1–50,000
100
Also show the prime at positionaccepts 1–50,000
1,000

Results

The nth prime
541
The previous prime
523
Gap to the previous prime
18
Prime at the second position
7,919

Step by step

  1. 1Values used
  2. 2Prime counting estimate
  3. 3The nth prime= 541
  4. 4The previous prime= 523
  5. 5Gap to the previous prime= 18
  6. 6Prime at the second position= 7,919

Assumptions and limits

  • The result is derived only from the 2 inputs listed above. Anything not among them is not part of the calculation.
  • In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
  • Figures are rounded for display to whole numbers, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.

How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.

Frequently Asked Questions

What is the 100th prime?

541. The 1000th is 7919.

Do prime gaps keep growing?

On average yes, roughly like ln p, but they fluctuate wildly and twin primes (gap 2) appear arbitrarily far out, conjecturally forever.

Nth Prime Number Calculator | Calcrivo