A prime number is a whole number greater than 1 with exactly two factors, 1 and itself (2, 3, 5, 7, 11, …). A composite number is a whole number greater than 1 with more than two factors (4, 6, 8, 9, 10, …). 1 is neither prime nor composite, because it has only one factor. 0 is also neither. 2 is the only even prime, and 4 is the smallest composite number.
Reviewed by the Helping with Math Team · Updated 14 October 2026
Prime and Composite Numbers
Every whole number greater than 1 is either prime or composite. The difference is how many factors it has. A factor is a number that divides another exactly, with no remainder.
A prime number has exactly two factors. A composite number has more than two. This lesson covers both, how to tell them apart, and why primes matter. See also composite numbers in more depth.
Prime numbers
A prime number has exactly two factors: 1 and itself. The number 5 has only the factors 1 and 5, so it is prime. The number 6 has the factors 1, 2, 3 and 6, so it is not prime. The number 1 has only one factor, so it is not prime either.
Another way to see it: a prime number of objects cannot be arranged in a rectangle with more than one row (except one long row). 7 counters can only make a 1 × 7 row, because 7 = 1 × 7 is its only factor pair. 11 is the same: 11 = 1 × 11.
Definition: a prime number is a whole number greater than 1 whose only factors are 1 and itself.
Examples
17 = 1 × 17 only, so 17 is prime. The primes below 30 are 2, 3, 5, 7, 11, 13, 17, 19, 23 and 29.
Primes are the building blocks of number theory, and they are used every day in internet security, as explained below.
Properties of prime numbers
- A prime number is a whole number greater than 1.
- It has exactly two factors: 1 and itself.
- 2 is the only even prime. Every other even number can be divided by 2.
- Any two different primes are co-prime: their only common factor is 1.
- Every whole number greater than 1 can be written as a product of primes in exactly one way (apart from order).
Composite numbers
A composite number is a whole number greater than 1 that has more than two factors. In other words, it has at least one factor other than 1 and itself, so it can be written as a product of two smaller whole numbers.
The first few composite numbers are 4, 6, 8, 9 and 10. Every even number greater than 2 is composite.
Example: 12 can be divided by 1, 2, 3, 4, 6 and 12, so it has six factors and is composite.
Example: 18 ÷ 1 = 18, 18 ÷ 2 = 9, 18 ÷ 3 = 6, 18 ÷ 6 = 3, 18 ÷ 9 = 2 and 18 ÷ 18 = 1. So 18 has six factors (1, 2, 3, 6, 9, 18) and is composite.
A composite number of counters can be arranged in a rectangle with more than one row. Six counters make 2 rows of 3, because 6 = 2 × 3. Composite numbers are multiples of smaller numbers.
A common question: is 0 prime or composite? Neither. And 1 is neither, too. Only whole numbers greater than 1 are sorted into prime and composite.
How to work out composite numbers
To work out whether a number is composite, list its factors. If you find any factor other than 1 and the number itself, it is composite.
Example: is 14 composite? 14 ÷ 1 = 14, 14 ÷ 2 = 7, 14 ÷ 7 = 2 and 14 ÷ 14 = 1. The factors are 1, 2, 7 and 14, which is more than two, so 14 is composite.
Types of composite numbers
Composite numbers can be odd or even.
Odd composite numbers are composite numbers that are odd, such as 9, 15, 21, 25, 27 and 33. The smallest is 9.
Even composite numbers are composite numbers that are even, such as 4, 6, 8, 10, 16 and 28. Every even number except 2 is composite. The smallest is 4.
Prime numbers vs composite numbers
| Prime numbers | Composite numbers |
|---|---|
| Greater than 1, with exactly two factors | Greater than 1, with three or more factors |
| The smallest prime is 2 | The smallest composite is 4 |
| 2, 3, 5, 7, 11, 13, … | 4, 6, 8, 9, 10, 12, … |
| 2 is the only even prime | Every even number above 2 is composite |
| Counters make only a single row | Counters make a rectangle with more than one row |
Chart of prime and composite numbers
In the chart of 1 to 100, the prime numbers are shaded green. There are 25 of them. 2 is the only even one, and 1 is shaded gray because it is neither prime nor composite.
Is there a prime number pattern?
Primes do not follow a simple sequence, but you can find all the primes up to a number with the sieve of Eratosthenes: cross out every multiple of 2 (after 2), then of 3, 5 and 7. For numbers up to 100 you only need to go up to 7, because 7 × 7 = 49 is below 100 and 11 × 11 = 121 is above it. Whatever is left is prime.
How to tell if a number is prime or composite
To decide, try dividing. Divisibility rules make this quick, and prime factorization breaks a composite number into its prime factors.
- If the number has a factor other than 1 and itself, it is composite.
- Every even number greater than 2 is composite.
- You only need to test primes up to the square root of the number. To test 91, try 2, 3, 5 and 7 (since 10 × 10 = 100): 91 = 7 × 13, so it is composite.
- If the prime factorization has two or more primes multiplied together, the number is composite.
Try the checker below. It shows every way to arrange the counters in a rectangle.
12 is composite: it has 6 factors. Factors: 1, 2, 3, 4, 6, 12. Factor pairs: 1 × 12, 2 × 6, 3 × 4.
What is the smallest composite number?
The smallest composite number is 4, with factors 1, 2 and 4. The smallest prime is 2, the smallest odd prime is 3, the smallest odd composite is 9, and the smallest number with exactly six factors is 12.
Prime vs co-prime numbers
Prime and co-prime are different ideas. “Prime” describes one number. “Co-prime” describes a pair: two co-prime numbers have no common factor except 1. Their greatest common factor is 1 (see how to find the greatest common factor).
Examples of co-prime pairs: 5 and 9, 6 and 11, 18 and 35. Neither 18 nor 35 is prime, so co-prime numbers do not have to be prime.
Useful facts
- 2 is the only even prime number; every other even number is divisible by 2.
- A number is divisible by 3 if the sum of its digits is a multiple of 3.
- No prime greater than 5 ends in 5, because any such number is divisible by 5. No prime greater than 2 ends in 0, 2, 4, 6 or 8.
- 0 and 1 are neither prime nor composite.
- Every whole number greater than 1 is either prime or composite.
Why prime numbers matter
Every whole number greater than 1 can be written as a product of primes, and only one way (apart from order). This is the fundamental theorem of arithmetic. For example:
- 222 = 2 × 3 × 37
- 123,228,940 = 2 × 2 × 5 × 23 × 79 × 3,391
Multiplying primes together is easy, but nobody knows a fast way to do the reverse for very large numbers. Modern internet security uses this. A website can publish a huge number made by multiplying two secret primes; anyone can use it to lock a message, but only someone who knows the two primes can open it.
Primes also appear in stories: in Carl Sagan’s novel Contact, aliens send a list of primes to show their signal comes from intelligent life.
Solved examples
Is 127 prime or composite?
Since 11 × 11 = 121 and 12 × 12 = 144, we only need to test the primes 2, 3, 5, 7 and 11.
- 127 is odd, so it is not divisible by 2.
- By the divisibility rule for 3, add the digits: 1 + 2 + 7 = 10, which is not a multiple of 3.
- It does not end in 0 or 5, so it is not divisible by 5.
- 127 ÷ 7 = 18 remainder 1.
- 127 ÷ 11 = 11 remainder 6.
No prime up to 11 divides 127, so 127 is prime.
Is 51 prime or composite?
5 + 1 = 6 is a multiple of 3, so 51 is divisible by 3: 51 = 3 × 17. 51 is composite.
More practice: prime and composite numbers worksheets, prime numbers worksheets and the prime and composite numbers worksheet download.
Prime and composite numbers FAQs
Is 1 prime or composite?
Neither. 1 has only one factor, and primes need exactly two.
What is the difference between prime and composite numbers?
A prime has exactly two factors (1 and itself). A composite number has more than two.
Is 2 a prime number?
Yes. 2 is the smallest prime and the only even prime.
What is the smallest composite number?
4, whose factors are 1, 2 and 4.
Is 0 prime or composite?
Neither. Only whole numbers greater than 1 are prime or composite.
Is 51 prime?
No. 51 = 3 × 17, so it is composite.








