You have reached the final lesson of **Foundations of Factors and Multiples
** — and it is the one that gives the course its name. Over the first three lessons, you mastered factors, factor pairs, complete factor lists, and multiples. Each of those skills was a stepping stone leading here.
Now we put them to work. In this lesson, we will sort every whole number greater than 1 into one of two categories — prime or composite — based on how many factors it has. We will also settle the question of where 1 belongs and discover why prime numbers earn the title of "building blocks" for all other numbers.
A Quick Look Back at Factor Counts
Recall from Lesson 2 that every whole number has a complete factor list. Some lists are short and some are long. Let's line up a few familiar examples:
Number
Complete factor list
How many factors?
2
1,2
2
7
1
Prime Numbers
A prime number is a whole number greater than 1 that has exactly two factors: 1 and the number itself. No other whole number divides it evenly.
Consider 13. If we test every whole number from 2 up to 12, none of them divides 13 without a remainder. The only factors are and , giving us exactly two, so is prime. The first several prime numbers are:
Composite Numbers
A composite number is a whole number greater than 1 that has more than two factors. That means at least one whole number besides 1 and the number itself divides it evenly.
Take 18. Its complete factor list is 1,2,3,6,9, — six factors in total. Since that is more than two, is composite. Here are a few more examples:
Where Does 1 Fit?
The number 1 is a common source of confusion. It might feel like a prime because it cannot be broken into smaller whole-number factors. However, recall the definition: a prime must have exactly two factors. The only factor of 1 is 1 itself, so its factor count is just one.
Because 1 has fewer than two factors, it does not qualify as prime. And because it does not have more than two factors, it is not composite either. Mathematicians therefore classify 1 as neither prime nor composite — a special case we will revisit at the end of the lesson when we see why this choice matters.
Checking Larger Numbers
For small numbers like 2 through 10, you can probably classify them from memory. But what about a number like 31 or 39? The technique is the same systematic approach from Lesson 2: test potential factors starting from 2.
Let's check 39. We try : since is odd, does not divide it. We try : with no remainder. We found a factor other than and , so is — no need to keep testing.
Primes as Building Blocks
Here is the most important idea in this lesson. Every composite number can be written as a product of prime numbers. Let's see this in action with 60:
60=2×30
The factor 30 is still composite, so we split it further:
60
Conclusion and Next Steps
In this lesson, you classified every whole number greater than 1 as prime (exactly two factors) or composite (more than two factors) and established that 1 is neither. You also discovered the deeper reason primes matter: they are the irreducible pieces from which every composite number is built, a principle captured by the Fundamental Theorem of Arithmetic.
Now it is time to put your understanding to the test. In the practice exercises ahead, you will classify numbers on sight, sort them into prime and composite groups, hunt for primes in unfamiliar ranges, and break a composite number all the way down to its prime building blocks. Jump in and see how solid your number sense has become!
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal
,
7
2
12
1,2,3,4,6,12
6
15
1,3,5,15
4
1
1
1
Notice the pattern: some numbers have exactly two factors, others have many more, and 1 stands alone with just one. That difference in factor count is precisely what separates prime numbers from composite numbers, and it is the focus of everything that follows.
1
13
13
2,3,5,7,11,13,17,19,23,29,…
A couple of things worth noting. First, 2 is the smallest prime and also the only even prime, because every other even number is divisible by 2 and therefore has at least three factors. Second, being prime is not about being odd or "looking special." It comes down to one simple test: does the number have exactly two factors?
18
18
Number
Factors
Factor count
Classification
4
1,2,4
3
Composite
9
1,3,9
3
Composite
20
1,2,4,5,10,20
6
Composite
25
1,5,25
3
Composite
Every composite number has at least one factor pair beyond the guaranteed pair of 1 and the number itself. For instance, 20=4×5, so 4 and 5 are factors that make 20 composite. If you ever find even one factor other than 1 and the number, you can stop — the number is composite.
2
39
2
3
39÷3=13
1
39
39
composite
Now let's check 31. We test 2 (no, 31 is odd), 3 (31÷3=10 remainder 1), 4 (skip — if 2 didn't work, 4 won't either), and 5 (31 does not end in 0 or 5) — none divide evenly. Because 6×6=36>31, we only needed to test up to 5; once the test factor squared exceeds the number, any remaining factor pair would already have been found. So 31 is prime.
This shortcut saves real work with bigger numbers. To check whether 97 is prime, for instance, you only need to test 2,3,4,5,6,7,8,9 — because 10×10=100>97.
Actually, you only need to test the prime numbers below that limit (2,3,5,7). You can skip 4,6,8, and 9 because if 2 didn't divide 97, then no multiple of 2 (like 4,6, or 8) will divide it either. This makes the prime test even faster! After confirming none of those primes divide 97 evenly, you know it is prime.
=
2×
2×
15
And 15 is also composite:
60=2×2×3×5
Now every factor in the product (2,2,3,5) is prime, and the process stops. It must stop, because a prime number cannot be split into smaller whole-number factors. That is exactly what makes primes irreducible: they are the endpoint of any splitting process.
Think of it like building with LEGO bricks. Composite numbers are the assembled structures — they can always be taken apart into smaller pieces. Primes are the individual bricks that cannot be broken down any further. No matter what composite number you start with, the breaking-apart process always ends at primes.
This idea has a formal name: the Fundamental Theorem of Arithmetic. It states that every whole number greater than 1 is either prime itself or can be expressed as a product of primes in exactly one way (apart from rearranging the order). This is also why 1 is excluded from the primes — if 1 were considered prime, we could slip as many 1s as we like into any product, and the "exactly one way" guarantee would fall apart.