Prime Checker
Test whether a given integer is prime, with trial-division proof.
Inputs
Positive integer to test for primality.
Is Prime?
Yes
Smallest Factor
N/A (prime)
Step by step
Trial division
Checked all divisors up to √97 ≈ 9
Conclusion
= 97 is prime
How it works
A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. This calculator uses trial division: it tests all potential factors from 2 up to √n. If none divide n evenly, n is prime. Trial division is efficient for numbers up to about 10¹⁵.
Formula
Trial division bound
Test divisors d from 2 to floor(√n). If none divide n, n is prime.
- n
- Number to test
- d
- Trial divisor
Frequently Asked Questions
Is 1 prime?
No. By convention, 1 is neither prime nor composite. The smallest prime is 2, which is also the only even prime.
Why only check up to the square root?
If n = a × b and both a and b are greater than √n, then a × b > n — a contradiction. So at least one factor of a composite number must be ≤ √n.