Prime Number Checker

A prime number has exactly two distinct divisors: one and itself. This calculator tests any number and shows its factors when it is not prime.

Formula

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

  • Testing only to the square root is enough, since factors come in pairs
  • 1 is not prime; 2 is the only even prime

97: test to √97 ≈ 9.8, so check 2, 3, 5 and 7 — none divides it, so it is prime

How Primality Is Tested

You only need to test divisors up to the square root of the number. If nothing divides it by then, nothing will.

The reason is neat: factors come in pairs that multiply to the number, and one of each pair is always at or below the square root. Testing 97 therefore needs divisors only up to 9.85, so checking 2, 3, 5 and 7 settles it.

Facts Worth Knowing

  • 2 is the only even prime, since every other even number divides by 2.
  • 1 is not prime. It has only one divisor, not two, and excluding it keeps prime factorisation unique.
  • Primes never run out. Euclid proved this over two thousand years ago.
  • They thin out as numbers grow, but never stop appearing.

The first few are 2, 3, 5, 7, 11, 13, 17, 19, 23, 29.

Why Primes Matter Practically

Every whole number above 1 factors into primes in exactly one way — the fundamental theorem of arithmetic. That uniqueness makes primes the building blocks of number theory.

It also underpins modern encryption. RSA relies on the fact that multiplying two large primes is trivial while factoring the result back is not: a 2048-bit key is secure precisely because no known method factors it in reasonable time.

Quick Reference

How thinly primes spread as numbers grow.
RangePrimes in itDensity
1–10440%
1–1002525%
1–1,00016816.8%
1–10,0001,22912.3%
1–100,0009,5929.6%

Frequently Asked Questions

How do I check if a number is prime?
Test whether any number up to its square root divides it exactly. For 97 you only need to check up to about 9.85.
Is 1 a prime number?
No. A prime has exactly two distinct divisors, and 1 has only one. Excluding it also keeps prime factorisation unique.
Why is 2 the only even prime?
Because every other even number is divisible by 2 as well as by 1 and itself, giving it more than two divisors.
Why do primes matter for encryption?
Multiplying two large primes is easy but factoring the product back is computationally hard, which is the basis of RSA encryption.

Related Calculators