Prime Number Checker
Prime Number Calculator
Check whether a number is prime or composite, see factor tests, divisibility notes, examples, and related number tools. Enter a whole number and the calculator checks divisibility up to the square root of the number.
Check if a number is prime
97 is prime.
Prime number test
To test a number n, check divisibility by integers from 2 through the square root of n.
\[\text{trial divisors} \le \sqrt{n}\]
Exact deterministic Miller–Rabin test for unsigned 64-bit integers. Enter an integer whose absolute value is at most 9,007,199,254,740,991.
If none divide evenly, the number is prime.
Examples
| Number | Result |
|---|---|
| 2 | Prime number |
| 9 | Composite number · 3 × 3 |
| 17 | Prime number |
| 21 | Composite number · 3 × 7 |
| 97 | Prime number |
Related math tools
Is Prime Number Calculator FAQ
Is 1 prime?
No. A prime number must have exactly two positive divisors, and 1 has only one.
Is 2 prime?
Yes. 2 is prime and it is the only even prime number.
Why test only up to the square root?
If a number has a factor larger than its square root, it must also have a matching factor smaller than the square root.
What is a composite number?
A composite number has more than two positive divisors, such as 4, 6, 8, 9, 10, and 12.
