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. The checker reports prime or not prime; to see factors of a composite number, divide it by small primes up to its square root.
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 result says the number is prime or not prime.
- 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.
Prime numbers from 1 to 100
There are 25 prime numbers below 100: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89 and 97. For example, 97 is prime, while 91 is composite because 91 = 7 × 13 and 87 is composite because 87 = 3 × 29. Enter any of these values above to compare the result with the list.
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.
Is 97 a prime number?
Yes. The square root of 97 is about 9.85, and 97 is not divisible by 2, 3, 5 or 7, so its only positive factors are 1 and 97.
How many prime numbers are there between 1 and 100?
There are 25, starting with 2, 3, 5, 7 and ending with 89 and 97.
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.
Related maths tools
For the square-root method with worked examples, read how to check whether any number is prime.