To find the next prime number, start with the number just after your given number and test each whole number until you find one with exactly two positive divisors: 1 and itself. The first number that passes that test is the next prime number.
Direct Answer
The next prime number after n is the smallest prime number greater than n. In notation, it can be written as:
next prime after n = the smallest prime p where p > n
For example, the next prime after 100 is 101, because 101 has no positive divisors other than 1 and 101.
Basic Method for Finding the Next Prime Number
Step-by-Step Logic
- Take the starting number n.
- Move to the next whole number, n + 1.
- If the candidate is less than 2, the next prime is 2.
- If the candidate is greater than 2 and even, skip it.
- Test whether the candidate has any factor from 2 up to its square root.
- If no factor divides it evenly, the candidate is prime.
- If it is not prime, move to the next candidate and repeat.
This works because every composite number has at least one factor less than or equal to its square root. So you do not need to test every possible divisor.
Square Root Test
To test whether a candidate number m is prime, check possible divisors only up to:
√m
If no whole number from 2 through √m divides m evenly, then m is prime.
Example: Find the Next Prime After 120
Start after 120. The next whole number is 121.
| Candidate | Test | Result |
|---|---|---|
| 121 | 121 = 11 × 11 | Composite |
| 122 | Even number greater than 2 | Composite |
| 123 | 123 is divisible by 3 | Composite |
| 124 | Even number greater than 2 | Composite |
| 125 | 125 is divisible by 5 | Composite |
| 126 | Even number greater than 2 | Composite |
| 127 | No divisor up to √127 | Prime |
The next prime number after 120 is 127.
Why You Can Skip Even Numbers
After 2, every even number is composite because it is divisible by 2. That means a next-prime search usually checks only odd candidates.
Math Note
2 is the only even prime number. If your starting number is less than 2, the next prime number is 2. If your starting number is 2 or greater, the next prime must be odd.
Check the Next Number
Enter a whole number and test whether a nearby number is prime or composite.
Fast Manual Process
If n Is Less Than 2
The next prime is 2.
If n Is Even and at Least 2
Start testing from n + 1, which is odd.
If n Is Odd
Start testing from n + 2, because n + 1 is even.
For each odd candidate, test divisibility by small primes such as 3, 5, 7, 11, 13, continuing only up to the square root of the candidate.
Examples of Next Prime Numbers
| Starting Number | Next Prime Number | Reason |
|---|---|---|
| 1 | 2 | 2 is the smallest prime number. |
| 10 | 11 | 11 has only two positive divisors. |
| 20 | 23 | 21 is divisible by 3, and 22 is even. |
| 100 | 101 | 101 has no divisor up to √101. |
| 113 | 127 | 114 through 126 are not prime. |
| 1000 | 1009 | 1009 passes the square root test. |
Trial Division vs Sieve Method
For one number, trial division is usually enough. For a whole range of numbers, the Sieve of Eratosthenes is often more efficient because it removes multiples in batches.
| Method | Best Use | How It Works |
|---|---|---|
| Trial Division | Finding the next prime after one number | Tests candidate numbers for divisibility up to the square root. |
| Square Root Test | Reducing manual work | Stops divisor checks once the divisor is greater than √m. |
| Sieve of Eratosthenes | Finding many primes in a range | Marks multiples of known primes as composite. |
| Computer Primality Test | Testing larger numbers | Uses programmed rules or algorithms to test primality. |
Common Mistakes
Prime and Not Prime Are Not Always Prime and Composite
A composite number is a whole number greater than 1 with more than two positive divisors. But 0, 1, and negative integers are not composite under the standard elementary definition. They are simply not prime.
Do Not Stop at the First Odd Number
Odd does not mean prime. For example, 121 is odd, but it is composite because 121 = 11 × 11.
Using a Prime Checker
If you want to test a candidate directly, use PrimeOrNot’s prime number checker. It can help verify whether a number near your starting point is prime, composite, or neither.
Related Tool
To find the next prime manually, test the numbers after your starting value. To verify a candidate, check whether it has exactly two positive divisors.
FAQ
What Is the Next Prime Number After 1?
The next prime number after 1 is 2. The number 1 is not prime because it has only one positive divisor.
What Is the Next Prime Number After 2?
The next prime number after 2 is 3. Although 2 is prime, the next prime must be greater than 2.
Can the Next Prime Be an Even Number?
Only if the next prime is 2. Every even number greater than 2 is divisible by 2, so it is composite.
Why Test Only Up to the Square Root?
If a number has a factor greater than its square root, it must also have a matching factor smaller than its square root. So checking beyond the square root is not needed.
Is There Always a Next Prime Number?
Yes. There are infinitely many prime numbers, so for any whole number, there is always a prime number greater than it.