Break any whole number apart and you reach the same tiny building blocks every time: the primes. Let's grow the tree that finds them — and see why it powers so much of maths.
Let's dig inPick any whole number bigger than 1 — say 12. You can always break it into a multiplication of smaller numbers, and keep breaking the pieces, until every piece is a prime that won't split any further. For 12, that's 2 × 2 × 3. That little string of primes is the number's DNA.
Three quick words you'll need, and we'll keep using them. A factor of a number is something that divides into it exactly, with no remainder — 2 and 3 are factors of 12, because 12 ÷ 2 and 12 ÷ 3 both come out clean. A prime is a number bigger than 1 whose only factors are 1 and itself — like 2, 3, 5, 7 — so it simply refuses to be broken down. And a product is just the answer you get when you multiply things together: 2 × 2 × 3 is a product, and its value is 12.
So prime factorisation means writing a number as a product made only of primes. It's like reading off a recipe: 12 isn't just "twelve," it's "two twos and a three, multiplied together." Once you can find that recipe, a surprising number of other jobs in maths — simplifying fractions, finding the highest common factor and lowest common multiple, even the codes that keep the internet safe — suddenly get easier, because they were really questions about primes all along.
Before we build trees, let's get a feel for primes by hand. Below are the numbers from 2 to 30. The golden ones are prime — they can't be split into smaller equal groups, so they're dead ends. The plain ones are composite, meaning they can be split. Tap any number to see what happens when you try to break it.
Notice the trick the splits use: when a number is composite, you can always pull out its smallest prime factor first — a 2 if it's even, then maybe a 3, a 5, a 7, and so on. Pull that prime off, and what's left is a smaller number you can attack the same way. Repeat until nothing splits. That simple, repeatable move is exactly what a factor tree does for you, automatically — so let's build one.
One thing worth pinning down now: 1 is not a prime, and it's not composite either. It's a special case all its own. If we counted 1 as prime, you could glue endless 1s onto any recipe (12 = 1 × 2 × 2 × 3 = 1 × 1 × 2 × 2 × 3…) and the "one true recipe" idea would fall apart. So primes start at 2. Keep that in your back pocket — it matters later.
Here's the heart of the page. Pick a number (type one, drag the slider, or tap a chip), then grow its tree. Each split pulls off the smallest prime and drops it as a golden leaf; the leftover keeps branching. Tap any white branch to split it yourself, or let the tree grow on its own. You're done when every leaf is gold — those leaves, multiplied together, are the number's prime DNA.
White circles are composite — they can still split. Golden circles are prime leaves — the journey's end. The factor tree is just the warm-up's "pull off the smallest prime" move, repeated until there's nothing left to pull.
Try a friendly number like 12 first, then something chunkier like 72 or 120, and watch how the tree grows taller the more primes hide inside. Try a prime like 17 or 23 too — the tree refuses to grow at all, because there's nothing to split. That's the tree telling you the number was already prime. However many primes a number contains, the tree's whole job is to keep splitting the white circles and never stop at one — because a white circle always has more to give.
When a prime shows up more than once, mathematicians don't like writing it out over and over. So instead of 2 × 2 × 3, they write 2² × 3. That little raised number — the index (you might also hear "power" or "exponent") — just counts how many times the prime is multiplied. So 2² means "two, used twice" (2 × 2 = 4), and 2³ means "two, used three times" (2 × 2 × 2 = 8).
Reading the tidy form is a real superpower, because it tells you the whole structure of a number at a glance. The moment you see 360 = 2³ × 3² × 5, you know 360 is built from three 2s, two 3s, and a single 5 — and you didn't have to do any dividing to read that off. By convention we list the primes smallest-first, which is exactly the order the factor tree finds them in.
Two worked recipes, start to finish, so the pattern sticks:
Notice both recipes started by stripping off all the 2s, then moved up to the next prime. That "smallest first, work upward" habit means you'll never miss a factor — and it's exactly what the tree above does on its own.
Here's the deepest, most beautiful fact about prime factorisation. You can start splitting a number in different ways — maybe you spot 60 = 6 × 10, while your friend spots 60 = 4 × 15. Different first moves, totally different-looking trees. But when the dust settles and every leaf is prime, you both reach the exact same set of primes. Pick a number, then try each first split below and watch the bottom bar never change.
Now pick a different way to start the split:
No matter which branch you start with, you always finish with the same golden leaves in the same amounts. That's not luck — it's a law.
This guarantee has a grand name: the Fundamental Theorem of Arithmetic. In kid-sized words, it says: every whole number bigger than 1 has exactly one prime recipe — one and only one (apart from writing the same primes in a different order). That's why it's fair to call the prime factorisation a number's "DNA" or "fingerprint": it belongs to that number alone, and no other number shares it.
Why should you care that the recipe is unique? Because it means the answer you get is the answer — there's no secret rival factorisation hiding somewhere that would give a different result. When you use primes to compare two numbers (which we're about to do), you can trust that you're comparing their true, one-of-a-kind ingredient lists. Without uniqueness, none of the tricks on the rest of this page would be allowed to work.
This is where prime DNA earns its keep. The HCF (highest common factor) of two numbers is the biggest number that divides into both. The LCM (lowest common multiple) is the smallest number that both divide into. Sounds like two separate chores — but with primes they're the same simple idea. Lay each number's primes into a two-circle picture: shared primes land in the middle. Drag the sliders to change the numbers.
Gold tokens in the overlap are the shared primes. Multiply just those and you get the HCF. Multiply everything in the whole picture (overlap counted once) and you get the LCM. Two answers, one diagram.
Walk through 12 and 18 by hand to see why it works. Their recipes are 12 = 2² × 3 and 18 = 2 × 3². What do they share? Both have at least one 2 and at least one 3 — so the shared part is 2 × 3 = 6, the HCF. For the LCM you need a number big enough to contain both recipes, so you take the most of each prime that appears anywhere: two 2s (from 12) and two 3s (from 18), giving 2² × 3² = 36, the LCM.
Here's a slightly chunkier pair worked all the way through, so the recipe is crystal clear:
The old way to find an LCM was to scribble out long lists of multiples (24, 48, 72, 96… and 36, 72, 108…) and hunt for the first one they share. That works, but it's slow and easy to get wrong. The prime way skips the hunt entirely: factorise once, then just read off the shared and the combined primes. For small numbers the list method is fine; for big ones, primes win every time. And it's the same diagram doing both jobs — which is the real payoff of knowing a number's DNA: one piece of work, two answers.
There's one slip that trips up nearly every beginner, plus a couple of cousins. They all come from the same place: stopping too soon. Here's how to spot them.
Not yet — neither 4 nor 9 is prime. A factor tree only stops at primes. Both 4 and 9 are white circles still waiting to split: 4 = 2 × 2 and 9 = 3 × 3. The real answer is 36 = 2 × 2 × 3 × 3 = 2² × 3². The rule of thumb: if a leaf isn't prime, you're not done. Keep going until every single leaf is a prime.
6 is composite, so it has to keep splitting. 2 × 6 is a true factorisation, but not a prime one. Split the 6 into 2 × 3 and you land on 2 × 2 × 3. A handy self-check: every number in your final answer must be one you couldn't break down further even if you tried.
1 isn't a prime, so it never belongs in a prime factorisation. Multiplying by 1 changes nothing, and if 1s were allowed you could add infinitely many — wrecking the "one unique recipe" rule. Leave 1 out entirely.
All three slips vanish if you remember a single test: look at every leaf and ask, "could this still be split?" If the answer is yes for any of them, the tree isn't finished. Primes are the only acceptable stopping points — that's the whole discipline of the method.
Prime factorisation isn't just a school exercise. Because every number has exactly one prime recipe, primes turn out to be the natural language for talking about how numbers relate. A few places it quietly does the work:
Multiplying two huge primes together is quick and easy. Un-multiplying the result — factoring it back into those primes — is so slow, even for powerful computers, that the difficulty itself is used to lock and protect data sent across the internet.
To shrink a fraction to its simplest form, you cancel the primes the top and bottom share — which is exactly their HCF. Prime DNA shows you instantly what cancels.
When two repeating cycles need to meet — gears turning, lights blinking, events repeating every few days — the moment they sync up is their LCM, read straight off their combined primes.
To add fractions with different bottoms, you need a common denominator — and the smartest one to use is their LCM, built from primes.
The thread running through all of these is the same idea you've been playing with: a number's primes are its honest description. Once you know them, questions that looked like separate puzzles — "what cancels?", "when do these line up?", "is this code safe?" — turn out to be the same question wearing different clothes. That's why mathematicians sometimes call the primes the "atoms" of arithmetic: everything else is built out of them.
Grow a factor tree: keep pulling off the smallest prime until every leaf is prime and nothing else can split.
Collect the primes and use indices for repeats: 12 = 2² × 3. That's the number's one-of-a-kind DNA.
Shared primes give the HCF; all the primes together give the LCM. The fingerprint does the heavy lifting.