Prime Number Checker
Check if any number is prime, find its prime factors, or generate all prime numbers in a given range. A prime number is a natural number greater than 1 that has no divisors other than 1 and itself.
Frequently Asked Questions
What makes a number prime
A prime has exactly two distinct divisors: 1 and itself. 7 qualifies; 9 does not, because 3 divides it.
1 is not prime — it has only one divisor. This is not an arbitrary exclusion: treating 1 as prime would break the fundamental theorem of arithmetic, which states every integer above 1 factors into primes in exactly one way. If 1 were prime, 6 could be 2×3 or 1×2×3 or 1×1×2×3, and uniqueness would collapse.
Testing by hand
Trial division only needs to run up to the square root of the number. If no prime at or below √n divides n, then n is prime.
The reason is that factors come in pairs: if n = a × b, one of them must be at or below √n. Checking beyond that point only re-finds partners you have already tested.
Example: for 97, √97 ≈ 9.8, so test 2, 3, 5 and 7. None divide it, so 97 is prime.
Quick divisibility checks
- 2 — last digit is even
- 3 — digit sum divisible by 3
- 5 — ends in 0 or 5
- 11 — alternating digit sum divisible by 11
Why primes matter
Modern public-key cryptography rests on an asymmetry: multiplying two large primes is fast, while factoring the product back into those primes is computationally infeasible at sufficient size. The security of a great deal of internet traffic depends on that gap.
Primes thin out as numbers grow but never run out — Euclid proved there are infinitely many, by a short argument still taught today.