Prime Number Checker
Enter a number to check if it is prime, list primes in a range, or find the prime factorization.
About Prime Numbers
A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself.
Trial division: if a number is not divisible by any integer from 2 to โn, it is prime.
Primes are infinite: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37 ...
Worked Examples
97 is prime: no divisor up to โ97 โ 9.85 divides it, so only 1 and 97 do.
Between 1 and 50 there are 15 primes: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43 and 47.
Limits of This Check
Only integers of 2 or more are meaningful; 1 is neither prime nor composite, and 0 and negatives are excluded. The check divides up to the square root, which is exact but slows down for very large inputs. Probabilistic tests such as Miller-Rabin are used in cryptography instead.
Frequently Asked Questions
- Why is 1 not a prime number?
- A prime must have exactly two divisors, 1 and itself. The number 1 has only one, and excluding it keeps prime factorisation unique.
- How many primes are there?
- Infinitely many. Euclid proved it: multiplying all known primes and adding one produces a number divisible by none of them, so a further prime must exist.
- Why can I stop checking at the square root?
- If a number n = a ร b, at least one of the factors is at most โn. So once no divisor up to โn is found, none exists beyond it either.