2 and 5: look at the last digit
360 → 0 · 2021 → 1
An even last digit means 2 divides the number; a last digit of 0 or 5 means 5 does. 2021 ends in 1, so neither 2 nor 5 can split it.
Primearium Lab · Mini-game
Split a number into two factors and its tree grows. Keep splitting until every leaf is a prime and bursts into bloom.
Tap a number, drag it onto a glowing bud, or type your own divisor.
Keyboard: type digits and press Enter · ← → choose a branch · H hint · M sound
Proven
The woodcutter's toolkit
360 → 0 · 2021 → 1
An even last digit means 2 divides the number; a last digit of 0 or 5 means 5 does. 2021 ends in 1, so neither 2 nor 5 can split it.
5040 → 5 + 0 + 4 + 0 = 9
If the digit sum is a multiple of 3, so is the number. 9 is, so 3 divides 5040. For 91 the sum is 10 — no luck.
91 → 9 − 2 × 1 = 7 · 221 → 22 + 4 × 1 = 26
For 7: drop the last digit and subtract its double. For 13: drop it and add four times it. If the result is a multiple of 7 (or 13), so was the number.
1001 → 1 − 0 + 0 − 1 = 0
Add and subtract the digits in turn. A result of 0, 11, −11, 22… means 11 divides the number. So 1001 = 11 × 91 = 7 × 11 × 13.
2021 = 45² − 2² = 43 × 47
A number just below a square is suspicious: a² − b² always splits into (a − b) × (a + b). That is how 2021, 221 = 15² − 2² and 3599 = 60² − 1² fall.
360 → 2, 2, 2, 3, 3, 5
Every prime leaf blooms with exactly as many petals as its number (up to 23). And whatever you do, a number with k prime leaves always needs exactly k − 1 splits: only wrong chops and hints cost stars.
Every integer n > 1 is a product of primes, and the multiset of primes is unique. Existence: split n until no factor is composite — it must stop, because the factors get smaller. Uniqueness rests on Euclid's lemma (Elements VII.30): if a prime p divides ab, then p divides a or p divides b. The first complete statement and proof is Gauss, Disquisitiones Arithmeticae (1801), Art. 16. A factor tree is exactly the existence proof drawn as a picture; “same leaves” is the uniqueness part.
A complete factor tree of n is a binary tree whose leaves are the Ω(n) prime factors of n counted with multiplicity. A binary tree with L leaves has L − 1 inner nodes, so every tree of n has exactly Ω(n) − 1 splits, whatever the order. This is why the game counts only wrong chops and hints as wasted moves. The shape is free: the depth ranges from ⌈log2 Ω(n)⌉ (balanced) to Ω(n) − 1 (one prime at a time).
Count trees up to swapping left and right branches. Then T(p) = 1 and T(n) = Σ T(a)·T(b) over unordered pairs {a, b} with ab = n and 1 < a < b, plus T(a)(T(a) + 1)/2 when n = a². Two classical special cases: for a prime power pk the inner labels are forced, so T(pk) is the number of unlabelled rooted binary trees with k leaves — the Wedderburn–Etherington numbers 1, 1, 1, 2, 3, 6, 11, 23, … (OEIS A001190); for a product of k distinct primes all leaves differ, so T = (2k − 3)!! = 1, 1, 3, 15, 105, 945, … (OEIS A001147), the number of rooted binary trees with k labelled leaves.
Computed in your browser with the recursion above; a separate verification program checks it against a brute-force enumeration of all trees for every n ≤ 2000 and against both classical sequences.
| n | Prime leaves | Factor trees T(n) |
|---|
10 ≡ 1 (mod 3) gives the digit-sum rule; 10 ≡ −1 (mod 11) gives the alternating sum. For 7: 10(a − 2b) = (10a + b) − 21b, so 7 | 10a + b ⇔ 7 | a − 2b. For 13: 10(a + 4b) = (10a + b) + 39b, so 13 | 10a + b ⇔ 13 | a + 4b. Fermat's method: an odd n = xy equals ((x + y)/2)² − ((y − x)/2)², so searching a = ⌈√n⌉, ⌈√n⌉ + 1, … for a square a² − n finds close factors at once. The “Giants” are highly composite numbers in Ramanujan's sense (1915): d(n) > d(m) for all m < n (OEIS A002182).
Euclid, Elements, Book VII, Prop. 30–32 · C. F. Gauss, Disquisitiones Arithmeticae (1801), Art. 16 · G. H. Hardy, E. M. Wright, An Introduction to the Theory of Numbers, Ch. I–II · S. Ramanujan, Highly composite numbers, Proc. London Math. Soc. 14 (1915) · OEIS A001190, A001147, A002182, A001222 (Ω).