Prime Number Checker
A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. This calculator checks whether a given positive integer is prime or composite. If the number is composite, it displays the smallest factor, which helps identify why it is not prime. For example, 17 is prime because no number other than 1 and 17 divides it evenly. In contrast, 18 is composite because it is divisible by 2 (the smallest factor). The algorithm checks divisibility only up to the square root of the number being tested, making it efficient for large numbers. Prime numbers are fundamental in mathematics and have practical applications in cryptography, computer security, and number theory. The calculator also provides a reference list of all prime numbers up to 1,000, helping you identify and understand the distribution of primes.
How to check for primality
To check if n is prime:
Test divisibility by all integers from 2 to sqrt(n).
If no divisors found, n is prime.
If a divisor is found, n is composite.
Prime numbers from 2 to 1,000
Prime number checker: frequently asked questions
What is a prime number?
A prime number is a natural number greater than 1 that has exactly two distinct positive divisors: 1 and itself. For example, 7 is prime because only 1 and 7 divide it. By definition, 1 is not prime.
What is a composite number?
A composite number is a positive integer greater than 1 that has at least one positive divisor other than 1 and itself. For example, 12 is composite because it is divisible by 1, 2, 3, 4, 6, and 12.
How do you check if a number is prime?
To check if a number n is prime, test whether any number from 2 to the square root of n divides it evenly. If no divisors are found, the number is prime. This works because if n has a factor greater than its square root, it must also have a factor less than its square root.
What is the smallest prime number?
The smallest prime number is 2. It is also the only even prime number. All other prime numbers are odd, because even numbers greater than 2 are divisible by 2.
How many primes are there?
There are infinitely many prime numbers. This was proven by the ancient Greek mathematician Euclid around 300 BCE. As numbers get larger, primes become rarer but never stop occurring.
Official sources
- Prime numbers: NIST Special Publication 330.
Reviewed by the CalculatorHub team, edited by James Graham, 14 June 2026. See our methodology.