Prime Number Checker
Type a whole number to find out whether it is prime, why, and which primes come just before and after it.
Any whole number up to 20 digits.
Is 221 prime?
Not prime
221 is not prime: it is divisible by 13 (221 = 13 × 17).
- Previous prime
- 211
- Next prime
- 223
- Prime factors
- 13 × 17
How to check whether a number is prime
A prime has exactly two factors, 1 and itself. To test n, try dividing it by the primes 2, 3, 5, 7, 11 … up to √n. If none divides it, n is prime; if one does, it is composite. You can stop at the square root because factors pair up: if n = a × b, one of a and b is at most √n.
For 221, √221 ≈ 14.9, so only 2, 3, 5, 7, 11 and 13 need trying. The first five leave remainders, but 221 ÷ 13 = 17 exactly, so 221 = 13 × 17 is not prime. Quick checks rule out most numbers: even numbers above 2, numbers ending in 5 or 0, and numbers whose digits add to a multiple of 3.
For very large numbers trial division would take far too long, so this checker switches to the Miller–Rabin test. With the first 13 primes as witnesses it gives a proven answer, with no chance of error, for every number below 3.3 × 10²⁴, which covers everything you can type here.
n is prime ⇔ n > 1 and no prime p ≤ √n divides n
- The largest known prime, found in October 2024 by the Great Internet Mersenne Prime Search, is 2^136,279,841 − 1, a number with 41,024,320 digits. Source: GIMPS, list of known Mersenne primes.
- Testing the first 13 primes as Miller–Rabin witnesses is deterministic for every n below 3,317,044,064,679,887,385,961,981. Source: Wikipedia, Miller–Rabin primality test.
How many primes there are
Primes up to each power of ten, counted with a sieve; they thin out, but never stop.
| Up to | Primes | Largest prime | Share of numbers |
|---|---|---|---|
| 10 | 4 | 7 | 40% |
| 50 | 15 | 47 | 30% |
| 100 | 25 | 97 | 25% |
| 500 | 95 | 499 | 19% |
| 1,000 | 168 | 997 | 16.8% |
| 10,000 | 1,229 | 9,973 | 12.29% |
| 100,000 | 9,592 | 99,991 | 9.59% |
| 1,000,000 | 78,498 | 999,983 | 7.85% |
Frequently Asked Questions
Is 1 a prime number?
No. A prime has exactly two different factors, and 1 has only one. Leaving 1 out keeps prime factorizations unique: otherwise 6 = 2 × 3 = 1 × 2 × 3 = 1 × 1 × 2 × 3 …
Is 2 the only even prime?
Yes. Every other even number is divisible by 2, so it has at least three factors (1, 2 and itself).
Is 91 prime?
No, although it looks it: 91 = 7 × 13. It is a classic trap because it is odd, doesn’t end in 5, and its digits add to 10, so the quick checks for 2, 3 and 5 all pass.
Are there infinitely many primes?
Yes. Euclid proved it: multiply any finite list of primes together and add 1; the result leaves remainder 1 when divided by each of them, so its prime factors are new primes.