Prime Factorisation

Every time you shop online or send a private message, huge numbers are being split into their prime building blocks — and the fact that this splitting is fiendishly hard for enormous numbers is exactly what keeps your bank details safe. That splitting has a name: prime factorisation.

Every whole number bigger than 1 is built by multiplying prime numbers together — and there is only one way to do it. That unique list of prime building blocks is the number's prime factorisation: its very own prime fingerprint.

For example, 24 is made from three 2s and one 3:

24 = 2 \times 2 \times 2 \times 3 = 2^3 \times 3

No other set of primes multiplies to 24. This "one and only one way" fact is so important it has a grand name: the fundamental theorem of arithmetic. Primes really are the atoms of the whole numbers — and just like an atom, a prime cannot be broken into a product of smaller whole numbers.

A baker has 12 cookies. She can pack them as 2 boxes of 6, or 3 boxes of 4, or 4 boxes of 3. But if she keeps breaking each box down into the smallest equal groups she can, she always finishes with the same three prime piles: 2, 2 and 3.

cookie cookie cookie cookie cookie cookie cookie cookie cookie cookie cookie cookie

Build it with a factor tree

The easiest way to find the prime factorisation is a factor tree. Split the number into any two factors, then split those, and keep going until every number at the bottom — every leaf — is prime. The leaves are the answer.

Watch it grow for 24. Step through the splits; the highlighted leaves at the end are its prime factors. (It doesn't matter which split you pick first — every choice lands on the same primes.)

Three worked examples

Build each tree in your head, collect the prime leaves, and write them smallest-first:

Two traps to avoid when you grow a factor tree:

Try a fresh number

Here a new number grows its own factor tree, one split at a time, all the way down to its primes. Step through it, then press Refresh for a different number and do it again. The highlighted leaves at the bottom are always prime — that is where each branch stops.

Writing the answer

Once the leaves are found, collect repeats into powers. Three 2s and one 3 become:

24 = 2^3 \times 3

By convention we write the primes in increasing order. Because the factorisation is unique, two people who split 24 differently — say 2 \times 12 versus 4 \times 6 — still end up with exactly 2^3 \times 3.

A frog splits 24 as 4 \times 6 first; a monkey starts with 2 \times 12. They argue about who is right — but when both keep splitting down to the primes, they land on the very same fingerprint 2 \times 2 \times 2 \times 3. There was nothing to argue about!

frog monkey

See it explained

Sal Khan builds prime factorisations with factor trees from scratch.