Understanding Prime Factorisation

Introduction

Welcome to Breaking Numbers Into Primes, the third course in our learning path! In the first two courses, we built a strong foundation with factors, multiples, prime and composite numbers, and handy divisibility shortcuts. Now it is time to put all of that knowledge to work in a powerful new way.

In this first lesson, we will explore what it means to break a number into its prime factors. We will see why every whole number greater than 1 can be written as a product of primes, learn how to verify that a factorisation is correct, and practise decomposing small numbers by inspection. Let's get started!

Primes: The Atoms of Numbers

As you may recall from earlier courses, a prime number is a whole number greater than 1 whose only factors are 1 and itself. Numbers like 22, 33, 55, 77, and 1111 are prime. A composite number, on the other hand, has additional factors and can be broken into smaller pieces.

Think of primes as atoms in chemistry. Just as every substance is built from atoms, every composite number is built from primes. No matter how large a number is, we can always split it into prime "building blocks." That idea is the heart of this entire course.

Prime numbers as building-block atoms composing composite numbers

What Prime Factorisation Means

Prime factorisation is the process of writing a whole number as a product of prime numbers. For example:

12=2×2×312 = 2 \times 2 \times 3

Every factor on the right side is prime, and when we multiply them together we get back to 1212. That expanded product, 2×2×32 \times 2 \times 3, is the prime factorisation of 1212. Because 1 is not a prime number, it is never included in a prime factorisation.

Here are a few more examples to build the pattern:

NumberPrime Factorisation
662×32 \times 3
18182×3×32 \times 3 \times 3
60602×2×3×52 \times 2 \times 3 \times 5
50502×5×52 \times 5 \times 5

Notice that every factor listed is prime. If even one factor in our product is composite, we have not finished factorising. For instance, writing 12=2×612 = 2 \times 6 is not a prime factorisation because 66 is composite — we would need to break 66 down further into 2×32 \times 3.

The Uniqueness Guarantee

One of the most important facts in all of mathematics is the Fundamental Theorem of Arithmetic. It states that every integer greater than 1 is either a prime itself or can be represented as a product of primes. Furthermore, every whole number greater than 1 has exactly one prime factorisation, apart from the order in which we write the factors.

In mathematics, a single prime number is considered a "product" of one prime. It’s similar to how a single brick is still considered a "building block," even if it hasn't been stacked with others yet. For a number that is already prime (like 77), its prime factorisation is just 77.

What does "apart from order" mean? Consider 1212 again. We could write 2×2×32 \times 2 \times 3, or 2×3×22 \times 3 \times 2, or 3×2×23 \times 2 \times 2. These are all the same collection of prime factors, just rearranged. No matter how we choose to break 1212 apart, we will always end up with two 22s and one 33 — there is no alternative set of primes that multiplies to 1212.

Two different factorisation paths for 12 converging to the same prime factorisation

This uniqueness is what makes prime factorisation so useful. It gives every number a kind of fingerprint that never changes, and later in this learning path we will use these fingerprints to find highest common factors and lowest common multiples efficiently.

Verifying a Prime Factorisation

Before we start building factorisations from scratch, let's practise a critical skill: checking whether a claimed factorisation is correct. To verify, we confirm two things:

  1. Every factor in the product is prime. If any factor is composite, the factorisation is incomplete.
  2. The factors multiply back to the original number. If the product is wrong, the factorisation does not match.

Example 1 — Correct factorisation: Is 2×2×72 \times 2 \times 7 a valid prime factorisation of 2828? All three factors (22, 22, 77) are prime ✓, and 2×2×7=282 \times 2 \times 7 = 28 ✓. Yes, this is correct.

Example 2 — Composite factor present: Is 2×142 \times 14 a valid prime factorisation of 2828? The factor 1414 is not prime (14=2×714 = 2 \times 7), so this fails immediately. Even though 2×14=282 \times 14 = 28, the factorisation is not complete because a composite factor remains.

Example 3 — Wrong product: Is 2×3×52 \times 3 \times 5 a valid prime factorisation of 2828? Every factor is prime ✓, but 2×3×5=30≠282 \times 3 \times 5 = 30 \neq 28 ✗. The factors do not multiply to the target number. Always multiply back to be sure!

Decomposing Small Numbers by Inspection

For small numbers, we can find the prime factorisation simply by thinking through what we already know about factors. The approach is straightforward:

  1. Start with the smallest prime, 22. If it divides the number, pull it out and work with what remains.
  2. Keep dividing by 22 until it no longer goes in evenly, then move to 33, then 55, and so on.
  3. Stop when the remaining number is itself prime — that last prime is your final factor.

Let's walk through 1818 using this approach. We begin by dividing: 18÷2=918 \div 2 = 9, so we pull out a 22. Now 99 is not divisible by 22, so we try 33: since 9÷3=39 \div 3 = 3, we pull out a 33, and the remaining 33 is already prime. Collecting everything gives us 18=2×3×318 = 2 \times 3 \times 3. A quick check confirms it: 2×3×3=182 \times 3 \times 3 = 18 ✓.

Step-by-step factor tree decomposing 18 into its prime factors 2, 3, and 3

Now try 3030. Dividing by 22 gives 1515, then 15÷3=515 \div 3 = 5, and 55 is prime, so we stop. The result is 30=2×3×530 = 2 \times 3 \times 5, confirmed by multiplying back: 2×3×5=302 \times 3 \times 5 = 30 ✓. With a little practice, you will be able to do this almost instantly for numbers under 100100.

Conclusion and Next Steps

Let's recap the key ideas from this lesson. Prime factorisation means expressing a number as a product where every factor is prime. The Fundamental Theorem of Arithmetic guarantees that every number greater than 1 is either prime or has a unique prime factorisation — no matter how you break a number apart, you always arrive at the same set of prime factors. To verify any claimed factorisation, simply check that every factor is prime and that the product equals the original number.

Up next, you will put these ideas into action with a set of hands-on practice tasks. You will verify given factorisations, compute products of primes, decompose small composites on your own, and explore firsthand why different splitting paths always lead to the same prime factors.

Sign up

Join the 1M+ learners on CodeSignal

Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal