There is a very old game you can play with any integer greater than 1: split it into two factors, then split each factor, keep going until nothing splits any more. What remains at the bottom are numbers that cannot be split further — the primes. The Fundamental Theorem of Arithmetic guarantees that no matter which splits you choose along the way, the primes at the bottom are always the same (in quantity and in kind), just in a different order.
This article gives you a divisibility tree — an interactive view of that game. You pick a branching strategy, watch the number unfold, and the leaves come out the same no matter how you branch.
The game
Start at the top with your integer n. Every step, you pick one non-prime node, choose a factorisation n_i = a \times b with 1 < a \leq b < n_i, and draw two child branches to a and b. If the node is already prime, it is a leaf — it cannot branch.
The game ends when every node in the tree is a leaf (every branch ends in a prime).
The striking fact: the multiset of leaves — the list of prime values, counted with multiplicity — does not depend on the choices you made along the way. Different branching strategies produce differently-shaped trees with the same leaves. That is the Fundamental Theorem of Arithmetic, visualised.
Try it with the slider
Below is an explorer. Drag the slider to pick an integer from 2 to 60, and the readout tells you the depth of the tree (how many "levels" until every branch reaches a prime) for one fixed branching strategy — always splitting off the smallest prime factor first.
What the tree tells you
Once the tree is fully built, two things are visible at a glance.
The leaves are the prime factorisation. Read them off with multiplicity. If 2 appears twice, 3 once, and 5 once, you have n = 2^2 \times 3 \times 5. The tree is the factorisation.
The product of the leaves is n. This is a consistency check you can do from any level: multiply all current leaves (including primes and pending splits) and you always get n. The operation of "split a node into two factors" preserves the product. It is a game where the product never changes.
Why the product is preserved: when you replace a node c with children a and b where c = a \times b, the product of the entire current set of nodes does not change. So after all the splits, the product of the leaves equals the original n.
The uniqueness theorem behind the tree
The claim that every tree for n has the same multiset of leaves is the Fundamental Theorem of Arithmetic, stated as a property of trees instead of as a statement about numbers. Formally:
If n \geq 2 and n is fully factored two different ways as n = p_1 \times p_2 \times \dots \times p_r and n = q_1 \times q_2 \times \dots \times q_s with all p_i, q_j prime, then r = s and the multisets \{p_1, \dots, p_r\} and \{q_1, \dots, q_s\} are equal.
That is a strong statement about the hidden structure of the integers. The tree makes it feel tangible: no matter how you start splitting, the primes at the bottom are forced.
The proof (which appears in the Number Theory Basics article in full) uses Euclid's lemma: if a prime p divides ab, then p divides a or p divides b. From that lemma, uniqueness of factorisation follows by strong induction on n.
Some fun patterns
Explore the slider and look for these regularities.
Powers of 2 (n = 2, 4, 8, 16, 32) give a tree that is a single vertical chain: every node splits into 2 and n/2. The leaves are all 2s. Depth is \log_2 n.
Products of two primes (n = 6, 10, 14, 15, 21, 22) give a tree of depth 1: one root, two leaves. These are called semiprimes.
Perfect squares of primes (n = 4, 9, 25, 49) also have depth 1, with both leaves identical.
Large factorials like n = 24 = 4! have very bushy trees: 24 = 2^3 \times 3, so the tree has four leaves (2, 2, 2, 3) and depth 3 if you greedy-split.
Primes themselves (n = 2, 3, 5, 7, 11, 13, \dots) have a tree that is a single node — the root is already a prime, so the tree is trivial with one "leaf" that is the root itself.
Why the tree is more than a picture
Seeing factorisation as a splitting process — instead of as a memorised answer — unlocks several later ideas.
The GCD and LCM appear as operations on leaves. To compute \gcd(a, b), take the intersection of the multisets of leaves for a and b (each prime appearing the minimum number of times it appears in either). To compute \text{lcm}(a, b), take the union (each prime appearing the maximum number of times).
The number of divisors is determined by the tree's leaf counts. If n = p_1^{a_1} \cdot p_2^{a_2} \cdots p_r^{a_r} (as read from the leaf counts), then n has exactly (a_1 + 1)(a_2 + 1) \cdots (a_r + 1) positive divisors.
Multiplicative functions (like Euler's totient) are easy to compute from the tree. The totient \varphi(n) equals n \cdot \prod_i (1 - 1/p_i) where the p_i are the distinct primes at the leaves.
Every one of these formulas becomes visible once you see the tree. The integer is not just a number — it is a structure with leaves, and operations on integers map to operations on those leaves.
A quick worked example: n = 72
Build the tree for 72 with the "greedy smallest prime" strategy.
- 72 = 2 \times 36
- 36 = 2 \times 18
- 18 = 2 \times 9
- 9 = 3 \times 3 (both leaves, because 3 is prime)
Reading leaves from top to bottom (or in any order): 2, 2, 2, 3, 3. So 72 = 2^3 \times 3^2.
Verify: 2^3 \times 3^2 = 8 \times 9 = 72. \checkmark
Divisor count: (3 + 1)(2 + 1) = 12. Indeed 72 has 12 positive divisors: 1, 2, 3, 4, 6, 8, 9, 12, 18, 24, 36, 72.
Now try a different strategy: 72 = 8 \times 9. Then 8 = 2 \times 4 = 2 \times 2 \times 2, and 9 = 3 \times 3. The tree is shaped differently, but the leaves are once again 2, 2, 2, 3, 3. Same multiset. Uniqueness again.
The one-line takeaway
Every integer \geq 2 is the root of a family of divisibility trees. The shapes of those trees vary wildly with your branching choices, but the multiset of prime leaves is invariant — and that invariance is the Fundamental Theorem of Arithmetic. The tree is the factorisation; the leaves are the primes; the primes are the atoms of the integer.
Next time you see a number, think of it as the root of a tree. The atoms are already there, waiting.
Related: Number Theory Basics · The Euclidean Algorithm as Rectangle-Tiling · Euclid's Proof of Infinite Primes · Mathematical Induction · Number Systems