Nth prime number calculator

Enter a position n to get the prime in that place, where the 1st prime is 2 and the 2nd is 3. It uses a full sieve, not an estimate.

Loading the tool…

Processing and privacy: The result is calculated inside your browser and your data is not sent to any server.

How to use it

  1. Enter position n.
  2. The result appears straight away and updates as you edit.
  3. Copy the result, or copy a link that keeps the same values to share it.

How it is calculated

Sieve up to the proven bound p(n) < n × (ln n + ln ln n) for n ≥ 6, then count primes until position n.

Example

Inputs: Position n = 100. Result: Prime number 100: 541; Previous prime: 523; Next prime: 547.

Limits and caveats

  • n runs from 1 to one million.
  • Counting starts with 2 as the 1st prime.

Questions about this tool

What is the 100th prime?

541, and the 1000th prime is 7919.

What is the millionth prime?

15485863.

Is there a direct formula for the nth prime?

No practical simple formula exists, so the tool sieves up to a proven bound and counts.