Prime Number Calculator (Is It Prime? Next and Previous Prime)
Enter a whole number to test whether it is prime.
Your numbers
Your results
Prime?
Prime?
—
Factorization
—
Next prime
—
Previous prime
—
Gap between them
—
Prime Number Calculator (Is It Prime? Next and Previous Prime) by TheCalcTools
How the Prime Number Calculator (Is It Prime? Next and Previous Prime) works
A prime has exactly two divisors, 1 and itself. The test divides by 2, 3 and every 6k ± 1 up to √n; if none divides evenly, n is prime.
Primes thin out slowly: near n, about one number in ln(n) is prime, so near a million roughly one in 14.
The formula
n is prime if no p ≤ √n divides n
Worked example
Using the default values shown in the calculator:
| Whole number | 1000 |
|---|
- 1000 is Composite: 2³ × 5³.
- The primes on either side are 997 and 1,009.
Result:
| Prime? | Composite |
|---|---|
| Factorization | 2³ × 5³ |
| Next prime | 1,009 |
| Previous prime | 997 |
| Gap between them | 12 |
Frequently asked questions
Is 2 the only even prime?
Yes. Every other even number is divisible by 2.
What is the next prime after 1000?
1009. The previous one is 997.
Sources and further reading
Related calculators
More in Math · All calculators
This calculator gives estimates for information only. Check important results independently before you rely on them. See our disclaimer.
