Factors & primes
Prime and Composite Numbers
A prime number has exactly two factors, 1 and itself. A composite number is a whole number greater than 1 that has more than two factors, so it can be split into a product of smaller whole numbers. This guide shows how to tell the two apart quickly, lists the composite numbers to 100, explains why 0 and 1 are neither, and walks through the sieve of Eratosthenes.
Prime vs composite: the difference
Count the factors. Every whole number greater than 1 lands in exactly one of two groups, and the factor count decides which.
A second way to say the same thing: a number is composite if you can write it as a × b where both a and b are whole numbers bigger than 1. You can write 15 as 3 × 5, so 15 is composite. You cannot do that with 13 — the only way to multiply to 13 is 1 × 13 — so 13 is prime. The full definition of a prime, with the list of primes to 100, is in the guide what is a prime number; this page is about telling the two kinds apart.
| Number | Factors | Count | Type |
|---|---|---|---|
| 1 | 1 | 1 | Neither |
| 2 | 1, 2 | 2 | Prime |
| 3 | 1, 3 | 2 | Prime |
| 4 | 1, 2, 4 | 3 | Composite |
| 5 | 1, 5 | 2 | Prime |
| 6 | 1, 2, 3, 6 | 4 | Composite |
| 7 | 1, 7 | 2 | Prime |
| 8 | 1, 2, 4, 8 | 4 | Composite |
| 9 | 1, 3, 9 | 3 | Composite |
| 10 | 1, 2, 5, 10 | 4 | Composite |
| 11 | 1, 11 | 2 | Prime |
| 12 | 1, 2, 3, 4, 6, 12 | 6 | Composite |
Notice that 4 and 9 have an odd number of factors. That happens only for perfect squares, because one factor pairs with itself (2 × 2, 3 × 3). Every other composite has its factors in matching pairs, so its count is even.
What are composite numbers?
Composite numbers are the whole numbers greater than 1 that are not prime. They are “composed” of smaller factors, which is where the name comes from. Some facts that make them easy to spot:
- The smallest composite number is 4. It is
2 × 2. The numbers 2 and 3 are both prime, and 1 is neither. - Every even number greater than 2 is composite. It has 2 as a factor in addition to 1 and itself, so it has at least three factors.
- The smallest odd composite number is 9. Odd composites hide more easily: 9, 15, 21, 25, 27, 33 and 35 are the ones below 36.
- Every number ending in 0 or 5, other than 5 itself, is composite, because 5 divides it.
- Composites outnumber primes. Of the 100 numbers from 1 to 100, 25 are prime, 1 is neither, and 74 are composite. The gap widens as numbers grow.
A composite with many factors splits evenly in lots of ways, which is why there are 12 inches in a foot and 60 minutes in an hour. The number 60 has 12 factors: 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30 and 60. A multiplication chart is, in effect, a grid of composite numbers — every entry inside it, apart from the row and column for 1, is a product of two numbers greater than 1.
Why 0 and 1 are neither prime nor composite
The prime/composite split only applies to whole numbers greater than 1. The two numbers below that line fail both definitions, for different reasons.
Why 1 is not prime
The number 1 has exactly one factor: itself. A prime needs exactly two, so 1 does not qualify. It is not composite either, because it cannot be written as a product of two whole numbers bigger than 1.
There is a deeper reason for the rule. Every composite number breaks down into primes in exactly one way — 12 = 2 × 2 × 3 and nothing else. If 1 counted as prime, that uniqueness would collapse, because you could tack on as many 1s as you liked:
Excluding 1 keeps every prime factorization unique, which the methods for finding the greatest common factor and least common multiple rely on.
Why 0 is not composite
Zero is divisible by every nonzero whole number (0 ÷ 7 = 0 exactly), so it has infinitely many divisors. That sounds very composite, but the definition requires a whole number greater than 1 — and 0 also cannot be written as a product of two whole numbers that are both greater than 1. It sits outside the system, along with 1.
What about negative numbers?
Prime and composite are defined for whole numbers greater than 1, so −7 is not called prime and −8 is not called composite. The page on whole numbers and natural numbers sets out which number sets these words apply to.
How to tell if a number is prime or composite
To classify a number, look for any factor other than 1 and itself. The moment you find one, the number is composite. If you check every candidate and find none, it is prime. Two shortcuts make the search short.
1. Use the quick divisibility tests first
- 2: the last digit is even.
- 3: the digits add up to a multiple of 3. For 87,
8 + 7 = 15, so 3 divides 87. - 5: the last digit is 0 or 5.
- 11: the alternating sum of the digits is a multiple of 11 (including 0). For 143,
1 − 4 + 3 = 0, so 11 divides 143.
2. Only test primes up to the square root
Factors come in pairs that multiply to the number. In each pair, one factor is at most the square root and the other is at least the square root. So if no prime up to √n divides n, nothing bigger can either, and n is prime. You do not need to try every number up to half of n.
Example: is 91 prime or composite?
The square root of 91 is about 9.54, so only the primes 2, 3, 5 and 7 need testing.
91 is composite. It looks prime because it is odd and avoids 3 and 5.
Example: is 97 prime or composite?
No prime up to the square root divides 97, so 97 is prime. It is the largest prime below 100.
Example: is 221 prime or composite?
The square root of 221 is about 14.87, so test the primes 2, 3, 5, 7, 11 and 13.
221 is composite. Use a square root calculator to find where to stop, and a remainder calculator for the trial divisions; any remainder of 0 settles it. The factor calculator does the whole check in one step and labels the result prime or composite.
The sieve of Eratosthenes
To find every prime and composite number up to some limit at once, the sieve of Eratosthenes is faster than testing numbers one at a time. It crosses out the multiples of each prime in turn.
- Write the numbers from 2 to your limit (here, 100).
- Circle 2, the first number. Cross out every multiple of 2 after it: 4, 6, 8, and so on.
- Move to the next number that is not crossed out (3). Circle it and cross out its multiples.
- Repeat with 5, then 7. Stop once the next prime squared is bigger than the limit. For 100 that happens at 11, because
11² = 121. - Everything still standing is prime. Everything crossed out is composite.
When you reach a prime p, you can start crossing out at p² instead of 2p. Any smaller multiple of p has a smaller prime factor and was already crossed out. For 7, the multiples 14, 21, 28, 35 and 42 are gone before you start, so the first new one is 49.
| Prime | Start at | New numbers crossed out (to 100) | How many |
|---|---|---|---|
| 2 | 4 | 4, 6, 8, … 100 (every even number) | 49 |
| 3 | 9 | 9, 15, 21, 27, … 99 (odd multiples of 3) | 16 |
| 5 | 25 | 25, 35, 55, 65, 85, 95 | 6 |
| 7 | 49 | 49, 77, 91 | 3 |
| Total composite numbers from 1 to 100 | 74 | ||
By the time you reach 7, only three composites below 100 are left — 49, 77 and 91, the only ones not divisible by 2, 3 or 5. The 25 numbers still standing are the primes below 100.
Every composite number breaks into primes
Primes are the building blocks; composites are what you build. Every composite number can be written as a product of primes, and — ignoring the order — there is only one way to do it. That is the fundamental theorem of arithmetic.
The prime factorization calculator produces these with a factor tree and a division ladder. Once you have the factorization, you can count the factors without listing them: add 1 to each exponent and multiply.
Example: how many factors does 60 have?
That matches the list of twelve factors given earlier. For 36 = 2² × 3², the count is 3 × 3 = 9, an odd number, because 36 is a perfect square.
A prime always gives exactly 2 by this formula, since it is p¹ and 1 + 1 = 2. Any composite gives 3 or more. Prime factorizations are also the cleanest route to the greatest common factor (the GCF calculator shows both methods) and the least common multiple, covered in how to find the GCF and LCM, and to reducing a fraction, as shown in how to simplify fractions.
List of composite numbers from 1 to 100
Here are all 74 composite numbers up to 100, grouped by tens. Any number from 2 to 100 that is missing from a row is prime.
| Range | Composite numbers | Count |
|---|---|---|
| 1–10 | 4, 6, 8, 9, 10 | 5 |
| 11–20 | 12, 14, 15, 16, 18, 20 | 6 |
| 21–30 | 21, 22, 24, 25, 26, 27, 28, 30 | 8 |
| 31–40 | 32, 33, 34, 35, 36, 38, 39, 40 | 8 |
| 41–50 | 42, 44, 45, 46, 48, 49, 50 | 7 |
| 51–60 | 51, 52, 54, 55, 56, 57, 58, 60 | 8 |
| 61–70 | 62, 63, 64, 65, 66, 68, 69, 70 | 8 |
| 71–80 | 72, 74, 75, 76, 77, 78, 80 | 7 |
| 81–90 | 81, 82, 84, 85, 86, 87, 88, 90 | 8 |
| 91–100 | 91, 92, 93, 94, 95, 96, 98, 99, 100 | 9 |
The longest unbroken run of composites below 100 is 90 through 96, seven numbers in a row, sitting between the primes 89 and 97. From 1 to 50 there are 34 composite numbers; from 51 to 100 there are 40.
Common mistakes
- Calling 1 a prime. It has one factor, not two. It is neither prime nor composite.
- Assuming odd means prime. 9, 15, 21, 25, 27 and 33 are all odd and all composite. So are 51 (
3 × 17), 57 (3 × 19), 87 (3 × 29) and 91 (7 × 13), the four that most often fool people. - Calling 2 composite because it is even. Its only factors are 1 and 2. It is the one even prime.
- Testing too far. You only need to try primes up to the square root. Testing 97 against every number up to 48 is wasted effort.
- Stopping too early. The opposite slip: checking 2, 3 and 5 and declaring 49 or 221 prime. Check every prime up to the square root, including the last one.
- Treating “composite” as “even”. Composite only means “has a factor other than 1 and itself”. Of the 74 composites below 100, 49 are even, but the other 25 are odd.
Frequently asked questions
What is the difference between prime and composite numbers?
A prime number has exactly two factors, 1 and itself, such as 7 or 13. A composite number has more than two factors, so it can be written as a product of two smaller whole numbers greater than 1, such as 15 = 3 × 5. Both terms apply only to whole numbers greater than 1, so 0 and 1 are neither.
Is 1 a prime or composite number?
Neither. The number 1 has only one factor, itself, so it does not meet the prime requirement of exactly two factors. It is not composite either, because it cannot be split into two whole numbers greater than 1. Leaving 1 out of the primes also keeps every prime factorization unique, so 12 = 2 × 2 × 3 has only one form.
Is 0 a composite number?
No. Zero is neither prime nor composite. The definitions only cover whole numbers greater than 1. Although every nonzero whole number divides 0, it cannot be written as a product of two whole numbers that are both greater than 1, so it does not fit the composite definition either.
What is the smallest composite number?
The smallest composite number is 4. It has three factors, 1, 2 and 4, because 4 = 2 × 2. The numbers 2 and 3 are prime and 1 is neither. The smallest odd composite number is 9, which equals 3 × 3.
Is 51 prime or composite?
51 is composite. Its digits add up to 5 + 1 = 6, a multiple of 3, so 3 divides it: 51 = 3 × 17. Its factors are 1, 3, 17 and 51. It is one of the most commonly misjudged numbers because it is odd and does not show up in the usual times tables.
Is 91 a prime number?
No, 91 is composite. It equals 7 × 13, so its factors are 1, 7, 13 and 91. Because the square root of 91 is about 9.54, testing the primes 2, 3, 5 and 7 is enough, and 7 divides it exactly. It is the largest composite below 100 that has no factor of 2, 3 or 5.
How many composite numbers are there from 1 to 100?
There are 74 composite numbers from 1 to 100. Of the 100 numbers, 25 are prime and the number 1 is neither, which leaves 100 − 25 − 1 = 74. Of those 74, 49 are even and 25 are odd. Between 1 and 50 there are 34 composite numbers.
Calculators for this
Every one of these shows the working, so you can check the method as well as the answer.
More guides
https://fourfunctioncalculator.com/prime-and-composite-numbers/