Is It a Prime Number? Prime Number Checker
Enter a whole number from 1 to 1,000,000,000,000 to test if it is prime.
Updated
Report a problem
Formula
A number n greater than 1 is prime if no whole number from 2 up to √n divides it. The smallest such divisor is its smallest factor; if none exists, n itself is the smallest factor. The next prime is found by testing n + 1, n + 2, ... in turn.
Worked example
91: √91 is about 9.5. 2, 3 and 5 do not divide it, but 91 ÷ 7 = 13, so 91 is not prime, its smallest factor is 7, and the next prime is 97 (92 to 96 are all composite). For 29, none of 2, 3, 5 divide it, so it is prime and the next prime is 31.
Frequently asked questions
What is a prime number?
A prime is a whole number greater than 1 whose only divisors are 1 and itself. 29 is prime. 91 is not, because 91 = 7 × 13.
Is 1 a prime number?
No. A prime must have exactly two divisors, and 1 has only one. Treating 1 as prime would also break the rule that each number has a single prime factorization.
How can I tell quickly if a number is prime?
Test whether any prime up to its square root divides it. For 91 the square root is about 9.5, and 7 divides 91, so it is not prime. For 29 none of 2, 3 or 5 divide it, so it is prime.
What is the next prime after a number?
It is the smallest prime strictly greater than your number. After 29 comes 31, and after 91 comes 97. After 1 trillion the next prime is 1,000,000,000,039.