Next prime calculator

Find the next prime number after any number. Also shows the gap to that prime.

After

How to find the next prime

Start from n+1 and test each number for primality until you find one. The next prime after 100 is 101. The next prime after 1000 is 1009.

Prime gaps

The gap between consecutive primes varies. Small gaps (2) create twin primes like (11,13). Large gaps exist too — there are arbitrarily long stretches of consecutive composite numbers.

Bertrand's postulate

For any n > 1, there's always a prime between n and 2n. So you never need to search very far.

Popular prime factorization problems
Related calculators