Welcome back to Breaking Numbers Into Primes! This is the second of four lessons in the course, and your understanding of prime factorisation is already taking shape. In our previous lesson, we explored what prime factorisation means, confirmed that every number has a unique prime "fingerprint," and practised decomposing small numbers by inspection. Now we are ready for a visual, structured method called the factor tree that keeps our work organised as numbers grow larger. Let's jump in!
Why We Need a Systematic Approach
What Is a Factor Tree?
Building a Factor Tree: Example with 36
A Larger Example: 60
Different Starting Splits, Same Result
Practical Tips for Building Factor Trees
Conclusion and Next Steps
In this lesson, we learned how to use factor trees to break any composite number into its prime factors in an organised, visual way. The process is straightforward: pick a factor pair, split composite factors further, and stop when every branch ends at a prime. We also saw firsthand that different starting splits always lead to the same set of prime factors, so there is no wrong way to begin.
Up next, you will put those branching skills into practice! You will complete partial factor trees, build your own from scratch for various numbers, explore how different starting pairs converge on the same answer, and explain your reasoning step by step.
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal
In the last lesson, we broke apart small numbers like 18 and 30 by mentally dividing out primes one at a time. That works nicely when numbers are small, but what happens with a number like 180 or 360? Keeping track of all the pieces in our heads gets tricky fast.
A factor tree solves this problem by giving us a clear visual framework. We write each split on paper, branch by branch, until every endpoint is prime. Think of it like mapping out a family tree for a number — the "ancestors" at the top are composite, and the final "descendants" at the bottom are always primes.
A factor tree starts with a composite number at the top and splits it into two factors on the branches below. If a factor is still composite, we split it again. If a factor is prime, we mark it and leave it alone — it becomes a leaf of the tree. We keep going until every branch ends at a prime, and multiplying all the leaves together gives us back the original number.
Here are the rules to follow at each step:
Choose any factor pair of the current number (both factors must be greater than 1).
Write the two factors as branches below the number.
Mark any prime factor as a leaf — it needs no further splitting.
Split any composite factor by repeating from step 1.
Stop when every branch ends at a prime.
Let's walk through 36 step by step to see the method in action.
Step 1: Pick a factor pair of 36. We will start with 4×9. Write 36 at the top, then draw branches down to 4 and 9. Neither is prime, so both still need splitting.
Step 2: Split 4 into 2×2. Both 2s are prime, so we mark them as leaves.
Step 3: Split 9 into 3×3. Both 3s are prime, so we mark them as leaves.
Step 4: Read off all the leaves: 2,2,3,3. The prime factorisation is:
36=2×2×3×3
A quick check confirms it: 2×2=4, 3×3=9, and 4×9=36 ✓.
Now let's try 60, choosing 6×10 as our starting pair.
Step 1: Write 60 at the top and branch into 6 and 10. Both are composite, so we keep going.
Step 2: Split 6 into 2×3. Both are prime — mark them as leaves.
Step 3: Split 10 into 2×5. Both are prime — mark them as leaves.
Step 4: Collect the leaves: 2,3,2,5. Writing them in order from smallest to largest:
60=2×2×3×5
Multiplying back: 2×2×3×5=4×15=60 ✓. Notice how the tree keeps everything organised — we never lose track of a factor along the way.
One of the best things about factor trees is that you cannot pick a "wrong" starting pair. The Fundamental Theorem of Arithmetic, which we met in the previous lesson, guarantees that every number has exactly one prime factorisation regardless of how you split it. Let's see this in action with two trees for 60.
Tree A begins with 60=6×10. Splitting 6 gives 2×3 (both prime), and splitting 10 gives 2×5 (both prime). The leaves are 2,3,2,5.
Tree B begins with 60=2×30. The 2 is already prime, so we only continue with 30. Splitting 30 into 5×6 gives a prime 5 and a composite 6, which splits further into 2×3. The leaves are 2,5,2,3.
The trees look different and the order of the primes varies, but both produce the exact same collection: two 2s, one 3, and one 5. This will happen every time, so you can always pick the split that feels easiest and trust that the final answer will be correct.
A few pointers will make your factor trees smooth and reliable:
Start with small primes when convenient. If the number is even, splitting out a 2 first often simplifies things quickly. But any valid pair works, so choose what feels comfortable.
Mark primes immediately. As soon as a branch lands on a prime, circle it or highlight it. This prevents accidentally trying to split a prime further.
Always multiply back. Once you have collected all the leaves, multiply them together to confirm the product equals the original number.
One common mistake is stopping too early. For example, if we split 72 into 8×9 and then write 8=2×4, we are not done — the factor 4 is still composite and must be split into 2×2. Every single leaf must be prime before the tree is complete.