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.
Pick any two numbers that multiply to 360. Here 36 × 10 works. Neither one is prime yet, so both stay white.
360 = 36 × 10
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
Each 6 splits into 2 × 3. Now every branch ends in a colored circle, so the tree is finished.
6 = 2 × 3
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
Three 2s make 2³ and two 3s make 3². This short form is the prime factorization.
360 = 23 · 32 · 5 = 8 · 9 · 5 = 360
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
cd svg-generator python3 -m svgmath render factor-tree --out /tmp/factor-tree
Source: svgmath/diagrams/factors.py