Formula
n is prime ⇔ n > 1 and its only divisors are 1 and n
- 0 and 1 are neither prime nor composite
- 2 is the only even prime
A prime has exactly two divisors: 1 and itself.
Worked examples
Is 97 prime?
- Whole number
- 97
Is 97 prime?
Prime
Previous prime: 89
Next prime: 101
Is 91 prime?
- Whole number
- 91
Is 91 prime?
Composite
Smallest prime factor: 7
Divisible by: 7 × 13 = 91
Previous prime: 89
How it works
A prime number is a whole number greater than 1 whose only divisors are 1 and itself: 2, 3, 5, 7, 11 and so on. Numbers with more divisors are composite, and 0 and 1 are neither. 2 is the only even prime, because every other even number is divisible by 2.
The checker uses the Miller–Rabin test with a fixed set of twelve bases (2 through 37), which is proven to give the correct answer for every number below about 3.3 × 10²⁴ — far beyond the 2⁵³ limit of this page — so the verdict is exact, not probabilistic. For composite numbers it also finds the smallest prime factor by trial division, and it searches outwards for the closest primes below and above your number.
To see every prime factor of a composite number use the Prime Factorization Calculator. The Divisibility Checker shows why a number is divisible by 2, 3, 9, 11 and others, and the HCF and LCM Calculator finds the greatest common factor of two numbers.
Assumptions and limits
- Exact for whole numbers up to 9,007,199,254,740,991 (2⁵³ − 1), the largest integer that browsers can represent exactly.
- Smallest-factor search stops at 10,000,000; beyond that the verdict is still exact but the factor may be reported only as larger than that.