Prime Number Calculator
Use this prime number calculator to test if a given number is prime or composite.
Is 97 prime?Yesdivisible only by 1 and itself
Previous prime89
Next prime101
Highest divisor to test9anything larger has a matching smaller factor
Divisors2
The method
test divisibility by every prime up to √n
Why √n is far enough
If n has a factor larger than its square root, the matching cofactor must be smaller than the square root — so it would already have been found. Testing up to √n is therefore complete, and it turns a hopeless search into a quick one: for a million, that is 1,000 tests rather than a million.