How to use the prime number checker
Enter a whole number n and press the button to see whether it is prime or composite. Instead of a bare yes or no, the tool also shows the prime factorization, every positive divisor, how many divisions were tried up to √n, and the previous and next prime, so you can see the evidence behind the verdict.
The method is trial division. A composite number always has a divisor no larger than √n, so dividing by 2 and then by odd numbers up to √n settles the question. For example 561 is divisible by 3, so it is composite and factors as 561 = 3 × 11 × 17. Numbers like that are known as Carmichael numbers because they pass some quick primality tests.
1 is neither prime nor composite. It has only one divisor, and excluding it keeps prime factorization unique. The smallest prime is 2, which is also the only even prime. Zero and negative numbers are outside the definition, so entering them shows a message instead of a verdict.
The supported range is 1 to 1,000,000,000,000 and the divisor list prints the 60 smallest divisors. The neighboring-prime search scans up to 10,000 candidates, and because nothing is smaller than 2, the previous prime reads None when n is 2 or less. The table records the divisor tried and the remainder for the first 12 steps.
Frequently asked questions
No. 1 has only one divisor, so it is neither prime nor composite. The smallest prime number is 2.
If n = a × b then one of the two factors is at most √n. So if nothing up to √n divides n, nothing larger will either.
No. 561 = 3 × 11 × 17, so it is composite. It is the smallest Carmichael number, a composite that passes some simple primality tests.