Math utility
Check whether a whole number is prime or composite
A prime number is an integer greater than 1 that has exactly two positive factors: 1 and itself. A composite number is greater than 1 and has additional positive factors. Enter a whole number to test its classification and review the available factor information.
How to use the prime number checker
- Enter a whole-number integer in the input field.
- Run the checker to test the number.
- Read whether the value is prime or composite and inspect the factor result.
- Try another integer to compare prime and composite examples.
Prime number examples and rules
The numbers 2, 3, 5, 7, 11 and 13 are prime. The number 2 is the only even prime; every other even integer greater than 2 is composite. For example, 21 is composite because it can be divided evenly by 3 and 7.
Zero and 1 are not prime numbers. Negative integers are not classified as prime numbers under the standard positive-prime definition. A prime number must be greater than 1 and have no positive divisors other than 1 and itself.
How to test divisibility efficiently
To determine whether an integer n greater than 1 is prime, it is sufficient to test possible divisors up to the square root of n. If no integer from 2 through the square root divides it evenly, the number is prime. This works because any factor larger than the square root would have a matching factor smaller than the square root.
For example, to test 29, check possible divisors 2, 3, 4 and 5. None divides 29 evenly, so 29 is prime. For 35, the divisor 5 gives 35 = 5 × 7, so 35 is composite.
Frequently asked questions
Is 1 a prime number?
No. A prime number has exactly two distinct positive factors. The number 1 has only one positive factor: itself.
Is 2 the only even prime number?
Yes. Every even integer greater than 2 is divisible by 2 and therefore has more than two positive factors.
How can I check a large number for primality?
For a basic divisibility test, checking possible factors up to the square root is sufficient. Very large integers may require specialised primality algorithms.
What is the difference between prime and composite?
A prime integer greater than 1 has exactly two positive factors. A composite integer greater than 1 has more than two.