Home / Math

Testing whether a number is prime

A prime number has exactly two divisors: one and itself. Primes are the atoms of arithmetic — every whole number above one factors into primes in exactly one way — and they underpin the public-key cryptography that secures the web. This checker tells you whether a number is prime and, if it is not, lists the factors that prove it.

How to use the Prime Number Checker

  1. Type a positive integer into Enter Number.
  2. The verdict appears immediately.
  3. If composite, the factor list shows exactly what divides it.
  4. Note that 1 is neither prime nor composite.

Formula and a worked example

n is prime if no integer from 2 to √n divides it exactly

Testing only up to the square root is the key shortcut. If n has a factor larger than √n, it must also have a paired factor smaller than √n — so checking the small half is enough. For 10,000 that means testing to 100 rather than 9,999.

Worked example

97 is prime: √97 is about 9.8, and none of 2, 3, 5 or 7 divides it, so the search ends there. 91 looks prime but is not — it is 7 × 13, and the checker lists both.

Frequently asked questions

Is 1 a prime number?

No. A prime must have exactly two distinct divisors; 1 has only one. Excluding it is what makes prime factorisation unique.

Is 2 prime?

Yes, and it is the only even prime — every other even number is divisible by 2.

Why stop testing at the square root?

Because factors come in pairs around the square root. If nothing below √n divides n, nothing above it will either.

What are primes used for?

RSA encryption relies on the fact that multiplying two large primes is easy while factoring the product back is not.

Related calculators

Other tools people use alongside the prime number checker.

Browse all 50 calculators