Factor Tree

Category: Number Theory   Level: 101

360 = 23 · 32 · 5

Split a number into two factors, then split those, until only primes are left. Any way you split it, the same primes come out.

Step through it

Watch it

Animated walkthrough

Step by step

Step 1: Split 360 into two factors

Pick any two numbers that multiply to 360. Here 36 × 10 works. Neither one is prime yet, so both stay white.

360 = 36 × 10

Step 1: Split 360 into two factors

Step 2: Split again

36 = 6 × 6 and 10 = 2 × 5. The 2 and the 5 are prime, so they get a color and stop growing. Primes are the dead ends of the tree.

36 = 6 × 6, 10 = 2 × 5

Step 2: Split again

Step 3: Split until every branch ends in a prime

Each 6 splits into 2 × 3. Now every branch ends in a colored circle, so the tree is finished.

6 = 2 × 3

Step 3: Split until every branch ends in a prime

Step 4: Collect the leaves

Gather the prime leaves and sort them. Their product is the number at the top of the tree.

360 = 2 × 2 × 2 × 3 × 3 × 5

Step 4: Collect the leaves

Step 5: Group repeats with exponents

Three 2s make 2³ and two 3s make 3². This short form is the prime factorization.

360 = 23 · 32 · 5 = 8 · 9 · 5 = 360

Step 5: Group repeats with exponents

Step 6: A different tree gives the same primes

Start with 360 = 4 × 90 instead. The tree looks different, but the leaves are the same six primes. This is the Fundamental Theorem of Arithmetic, and it never makes exceptions.

360 = 4 × 90 = 23 · 32 · 5

Step 6: A different tree gives the same primes

All steps at once

Storyboard

Generate it yourself

cd svg-generator
python3 -m svgmath render factor-tree --out /tmp/factor-tree

Source: svgmath/diagrams/factors.py