Prime Number Checker
Check whether a number is prime, find its factors, and see the nearest prime numbers above and below it.
Written by Rahman · Last reviewed
Quick answer
A prime is an integer greater than 1 divisible only by 1 and itself. Testing one only requires checking divisors up to its square root, because any factor larger than that must pair with a smaller factor already checked. 2 is the only even prime, and 1 is not prime by definition.
Results are estimates for general guidance only. Double-check any figure you rely on for an important decision.
About the Prime Number Checker
A prime number is a positive integer greater than 1 that has no divisors other than 1 and itself. The first few primes are 2, 3, 5, 7, 11, 13, 17, 19 and 23. Primes are the building blocks of the integers: every whole number above 1 is either prime or factorises uniquely into primes.
This checker tests whether a number is prime up to one trillion using trial division up to √n. For inputs up to one billion it also lists factors and the closest primes above and below; above that, only the primality test itself runs, since a factor or neighbour search gets too slow to stay responsive.
For each candidate divisor i from 2 to √n, test whether n is divisible by i. If any divides n, it isn't prime.
Trial division is fast enough for numbers up to about 10¹². For larger numbers, specialised tests like Miller–Rabin are used.
Frequently Asked Questions
Is 1 a prime number?
⌄
No. By definition primes must be greater than 1. The exclusion is partly historical and partly because it keeps important theorems (like unique factorisation) clean.
Is 2 the only even prime?
⌄
Yes. Every other even number is divisible by 2, so no even number above 2 can be prime.
How many primes are there?
⌄
Infinitely many, proved by Euclid over 2,000 years ago. There is no largest prime number, although the largest one humans have discovered grows each year as computing power increases.
Why are primes important?
⌄
Cryptography relies on the fact that multiplying two huge primes is easy but factoring the product back into its primes is hard. Internet security, banking and messaging all depend on this asymmetry.