Prime Number Checker

Enter a number, get a straight yes-or-no on primality — and if it isn't prime, the smallest factor that proves it, which is usually more useful than the verdict alone.

Inputs

Result

97 is prime

How the prime number checker works

A number is prime if it has no divisors other than 1 and itself. The check tests divisibility by every integer from 2 up to the square root of the number.

Testing only up to the square root is enough: if n has a factor larger than √n, it must also have a matching factor smaller than √n, so any factor would already have been found.

Worked example: is 97 prime?

  1. √97 ≈ 9.85, so only divisors 2 through 9 need checking.
  2. 97 is odd, not divisible by 3 (9+7=16), not by 5, and 97 ÷ 7 ≈ 13.86 (not exact).
  3. No divisor found up to 9, so 97 is prime.

Common mistakes to avoid

Assuming a large number needs checking all the way to itself

You only ever need to test up to the square root — for a number like 10,000, that's checking up to 100, not 10,000, which is why this runs instantly even for large inputs.

Forgetting that 1 is not prime

By definition, primes must have exactly two distinct divisors (1 and themselves). The number 1 has only one divisor, so it's excluded by convention, not by mistake.

Frequently asked questions

Is 2 the only even prime number?

Yes — every other even number is divisible by 2 in addition to itself and 1, which disqualifies it from being prime.

What's the largest number this can practically check?

Since the check only needs to go up to the square root, even numbers in the billions are checked essentially instantly.

What does 'divisible by X' in the result actually mean?

It's the smallest factor found, proving the number isn't prime — dividing your input by that factor gives a whole number with no remainder.

Are negative numbers or zero ever prime?

No, primality is only defined for integers 2 and above by convention.

Related calculators