Simple but seductive. That’s how I’d describe partitions. Except that they’re not so simple. There are hidden depths in the task of finding how many ways an integer can be expressed as the sum of smaller integers (and as the sum of itself). Here are the partitions of 4, for example:
4 = 1+3 = 2+2 = 1+1+2 = 1+1+1+1
4 (1) = 1+3 (2) = 2+2 (3) = 1+1+2 (4) = 1+1+1+1 (5), ∴ partcount(4) = 5
There are five partitions of 4, because an integer is counted as its own partition. Accordingly, partcount(4) = 5. But partcount(n) doesn’t return values in a predictable way:
partcount(1) = 1 ← 1
partcount(2) = 2 ← 2 = 1+1
partcount(3) = 3 ← 3 = 1+2 = 1+1+1
partcount(4) = 5 ← 4 = 1+3 = 2+2 = 1+1+2 = 1+1+1+1
partcount(5) = 7 ← 5 = 1+4 = 2+3 = 1+1+3 = 1+2+2 = 1+1+1+2 = 1+1+1+1+1
partcount(6) = 11 ← 6 = 1+5 = 2+4 = 3+3 = 1+1+4 = 1+2+3 = 2+2+2 = 1+1+1+3 = 1+1+2+2 = 1+1+1+1+2 = 1+1+1+1+1+1
partcount(7) = 15 ← 7 = 1+6 = 2+5 = 3+4 = 1+1+5 = 1+2+4 = 1+3+3 = 2+2+3 = 1+1+1+4 = 1+1+2+3 = 1+2+2+2 = 1+1+1+1+3 = 1+1+1+2+2 = 1+1+1+1+1+2 = 1+1+1+1+1+1+1
partcount(8) = 22 ← 8 = 1+7 = 2+6 = 3+5 = 4+4 = 1+1+6 = 1+2+5 = 1+3+4 = 2+2+4 = 2+3+3 = 1+1+1+5 = 1+1+2+4 = 1+1+3+3 = 1+2+2+3 = 2+2+2+2 = 1+1+1+1+4 = 1+1+1+2+3 = 1+1+2+2+2 = 1+1+1+1+1+3 = 1+1+1+1+2+2 = 1+1+1+1+1+1+2 = 1+1+1+1+1+1+1+1
1, 2, 3, 5, 7, 11, 15, 22, 30, 42, 56, 77, 101, 135, 176, 231, 297, 385, 490, 627, 792, 1002, 1255, 1575, 1958, 2436, 3010, 3718, 4565, 5604, 6842, 8349, 10143, 12310, 14883, 17977, 21637, 26015, 31185, 37338, 44583, 53174, 63261, 75175, 89134, 105558, 124754, 147273, 173525 — the number of partitions of n, A000041 at the Online Encyclopedia of Integer Sequences
And there are fractals — self-similarities at smaller and smaller scales — hidden in that simple arithmetic. Take the partitions of 8:
8 = 1+7 = 2+6 = 3+5 = 4+4 = 1+1+6 = 1+2+5 = 1+3+4 = 2+2+4 = 2+3+3 = 1+1+1+5 = 1+1+2+4 = 1+1+3+3 = 1+2+2+3 = 2+2+2+2 = 1+1+1+1+4 = 1+1+1+2+3 = 1+1+2+2+2 = 1+1+1+1+1+3 = 1+1+1+1+2+2 = 1+1+1+1+1+1+2 = 1+1+1+1+1+1+1+1 (c=22)
By definition, the sum of each partition of 8 is the same: 8. But the products — the result of multiplying the numbers of a partition — rise and fall wildly, hitting a maximum of 18 and a minimum of 1:
1.7 = 7
2.6 = 12
3.5 = 15
4.4 = 16
1.1.6 = 6
1.2.5 = 10
1.3.4 = 12
2.2.4 = 16
2.3.3 = 18
1.1.1.5 = 5
1.1.2.4 = 8
1.1.3.3 = 9
1.2.2.3 = 12
2.2.2.2 = 16
1.1.1.1.4 = 4
1.1.1.2.3 = 6
1.1.2.2.2 = 8
1.1.1.1.1.3 = 3
1.1.1.1.2.2 = 4
1.1.1.1.1.1.2 = 2
1.1.1.1.1.1.1.1 = 1
It’s interesting to ask when partitions(n) yield the biggest product (the answer is here). It’s also interesting to create graphs of prod(part(n)), the products of the partitions of n. You’ll see something I call partition fission. The graphs start to fissure into what look like fins or sails, and then each fin or sail starts to fissure too:
Graph for multiples of partitions(8) (partcount(8) = 22)
Graph for prod(part(9)) (partcount = 30)
prod(part(10)) (partcount = 42)
prod(part(11)) (partcount = 56)
prod(part(12)) (partcount = 77)
prod(part(13)) (partcount = 101)
prod(part(14)) (partcount = 135)
prod(part(15)) (partcount = 176)
prod(part(16)) (partcount = 231)
Those graphs are all on the same scale. The two graphs below have been adjusted to capture many more partitions and show the fractality coming into full flower:
prod(part(20)) (partcount = 627)
prod(part(28)) (partcount = 3718)
Finally, here’s an animated gif of the graphs for the partition-products of 8 to 16:

Animated gif for prod(part(8..16)) (animation at EZgif) (click for larger image)







