PuzzleReels
Sections

The Splitting Game

The maths · Episode 3 · 2:44 · gives the answer

The puzzle

Start with a pile of 49 counters. Split any pile into two, write down the product of the two sizes (say 23 and 26, so you write 598), and keep going until every pile is a single counter.

Add up everything you wrote. Does the total depend on how you split, and what is it?

The maths, properly

Proof one: count the pairs

Put the counters in a row and number them. There are (n2) pairs of counters.

Say you split a pile of a+b into a pile of a and a pile of b. The product ab is exactly the number of pairs you just pulled apart, one counter from each side. Once two counters are in different piles they never meet again, so no pair is pulled apart twice. And since everything starts together and ends alone, every pair is pulled apart once.

So the products count each pair exactly once. Their sum is the number of pairs, whatever order you went in.

Numbering the counters in a row loses nothing: any sequence of splits can be relabelled so that every pile is a run of consecutive numbers. That is what makes the picture below honest. A split writes down a rectangle of cells, and the rectangles tile the triangle of pairs.

Proof two: induction

Do not assume the total is the same whichever way you split. Prove it. Claim: every complete game on a pile of n totals n(n−1)2. Induct on n.

A single counter writes nothing, and 1·02=0, so the claim holds for n=1.

Take any game on a pile of n. Its first split gives piles a and b, with a+b=n, and writes ab. What is left is a complete game on the pile of a and a complete game on the pile of b, each played in whatever order the player likes. Both are smaller, so by the claim for smaller piles, they total a(a−1)2 and b(b−1)2, however they were played. So the whole game totals

ab+a(a−1)2+b(b−1)2=n(n−1)2

whichever split was made and whichever order the rest was played in. That proves the claim for n, so it holds for every n.

ab+a(a−1)2+b(b−1)2=2ab+a2−a+b2−b2
=(a+b)2−(a+b)2=n(n−1)2

The last line depends only on n, not on a, b or the order. That independence is what the induction proves; it is not assumed anywhere above.

Proof three: something that is conserved

Count the pairs of counters that are still together, meaning in the same pile:

Φ=∑piles(size2)

At the start Φ=(n2). At the end every pile is alone and Φ=0. A split of a+b into a and b lowers Φ by

(a+b2)−(a2)−(b2)=ab

which is exactly what you write down. So you write down what Φ loses, and Φ loses (n2) in total. (The identity is checked for every a,b≤300 below, as well as being a line of algebra.)

A worked case: seven counters

The film plays it on seven counters, because 21 cells fit on a screen and 1176 do not. Two plays, one total.

Down the middle

SplitWritten downTotal so far
7 → 3 + 43 × 4 = 1212
3 → 1 + 21 × 2 = 214
2 → 1 + 11 × 1 = 115
4 → 2 + 22 × 2 = 419
2 → 1 + 11 × 1 = 120
2 → 1 + 11 × 1 = 121

One at a time

SplitWritten downTotal so far
7 → 1 + 61 × 6 = 66
6 → 1 + 51 × 5 = 511
5 → 1 + 41 × 4 = 415
4 → 1 + 31 × 3 = 318
3 → 1 + 21 × 2 = 220
2 → 1 + 11 × 1 = 121

The second is the triangular number in person: 6+5+4+3+2+1=21. That is Gauss's sum, so the game also hands you a second proof of it.

Now put each play on the triangle of pairs. Every split is a rectangle, and the rectangles fit with no gap and no overlap. The plays are different, the triangle is the same.

1234562345671221411
Down the middle: 12 + 2 + 1 + 4 + 1 + 1 = 21
123456234567654321
One at a time: 6 + 5 + 4 + 3 + 2 + 1 = 21

Try to beat the total

Split a pile anywhere you like, or let a player do it, and see whether the total can come out different. The Bar tab is the continuous version, taken up below.

One play on ten counters: after every split, the score so far plus the pairs still together
SplitPile → partsScoreScore so farPairs still togetherSum
110 → 2 + 816162945
28 → 5 + 315311445
35 → 2 + 3637845
43 → 1 + 2239645
53 → 1 + 2241445
62 → 1 + 1142345
72 → 1 + 1143245
82 → 1 + 1144145
92 → 1 + 1145045

Generalising

Two changes to the rules leave the total fixed, and one does not (question 2 below). All three are checked.

Split into several piles at once, writing down every pair the move pulls apart (for piles of a, b and c that is ab+bc+ca). Still 1176 for 49 counters, in 5000 random games.

Give the counters weights, and write down the product of the two sides' total weights. The answer is no longer a count of pairs but a sum over them: with weights w1,…,wn,

∑i<jwiwj=(∑w)2−∑w22

Six counters weighing 3, 1, 4, 1, 5, 9 total 23, their squares total 133, and so the game is worth 198, however you split them:

Pile (weights)Split intoWritten downTotal so far
{3, 1, 4, 1, 5, 9}{3, 4, 5} | {1, 1, 9}12 × 11 = 132132
{3, 4, 5}{3, 5} | {4}8 × 4 = 32164
{3, 5}{3} | {5}3 × 5 = 15179
{1, 1, 9}{1, 1} | {9}2 × 9 = 18197
{1, 1}{1} | {1}1 × 1 = 1198

Why ab and not something else? Because ab is what is left of a square when you cut it in two: (a+b)2=a2+b2+2ab. Anything of the form g(a+b)−g(a)−g(b) telescopes in the same way, giving a fixed total g(n)−ng(1) whatever you do. Product is the one of them that also counts something: pairs.

A continuous version

Lay the counters end to end as a bar of length n, one unit each, and the film's game is cutting that bar, with one rule: you may only cut at whole numbers. Lift the rule.

Two things are new. You can always cut again, so the game never ends: the total is a limit, which you approach and never reach. And there is a new way to go wrong, which is to cut for ever without finishing.

What is conserved

Proof three survives with its binomials swapped for squares. A cut of p+q into p and q lowers 12∑mi2, half the sum of the squares of the piece lengths, by 12((p+q)2−p2−q2)=pq, which is exactly what you write down. So at every moment

total so far=M2−∑imi22

and you can read the score off the table without having watched the game. Finishing means the largest piece shrinks to nothing, and since

(maximi)2≤∑imi2≤(maximi)M

that is exactly when ∑mi2 goes to zero. So the total tends to M2/2 if you finish and falls short if you do not, and at every moment the shortfall is 12∑mi2.

The triangle, without the grid

The picture survives too. A pair of points of the bar is a point (x,y) of the triangle 0≤x<y≤M, of area M2/2. Cut the piece from s to e at t, and the pairs you pull apart are the ones with x left of the cut and y right of it: a rectangle t−s by e−t, of area exactly pq. The pairs not yet pulled apart are the ones inside a single piece, a small triangle on the diagonal of area 12mi2 for each piece. Cutting tiles the big triangle with rectangles, and the shortfall is the small triangles still showing.

0MM
Halve every piece, 3 rounds: 7 cuts, 87.5% of the triangle
0MM
Halve every piece, 6 rounds: 63 cuts, 98.4% of the triangle
0MM
Cut where darts land: 12 cuts, 88.4% of the triangle
0MM
Halve what is left, again and again: 8 cuts, 66.7% of the triangle

Halve every piece every round, and after k rounds there are 2k pieces of M/2k, so the score is M22(1−2−k):

Halve every piece, every round
RoundsCutsScoreStill to come
00012M2
1114M214M2
2338M218M2
37716M2116M2
4151532M2132M2
5313164M2164M2
66363128M21128M2
7127127256M21256M2
8255255512M21512M2
95115111024M211024M2
10102310232048M212048M2

The last panel never gets there. Halve the bar, then halve the right-hand half, then the right-hand quarter, for ever: you write down 14+116+164+⋯ of M2, which is M2/3, two thirds of the triangle. Infinitely many cuts, and the left half is never touched.

The same thing without a picture: pick two points of the bar at random. The chance they are in the same piece is ∑i(mi/M)2, so the score so far is M2/2 times the chance they have already been pulled apart, and finishing is that chance going to 1. (After three rounds of halving, 200,000 random pairs agree: seven in eight are apart.) In the language of measure theory it is one sentence: the rectangles never overlap and, once you have finished, they cover every pair with x<y, so their areas add up to the area of the triangle.

Order doesn't matter, speed does

After c cuts there are c+1 pieces, and ∑mi2 is smallest when they are equal, at M2/(c+1). So c cuts never score more than M22·cc+1, and coming within 1% of M2/2 takes at least 99 of them. How close a strategy comes to that depends on how evenly it keeps the pieces:

Cuts needed to come within 1% of M2/2
How you cutCuts
Shave slivers of M/100 off one end99
Halve the biggest piece110
Cut at a random point of the bar (median of 1,000 games)197
Shave slivers of M/1000 off one end905
Cut a random piece at a random point (median of 101 games; 31 were still short after 300,000)87,676
Halve what is left, then what is left of that, …never

Slivers of exactly M/100 are perfect, because they end at a hundred equal pieces. Thinner slivers waste cuts on pieces smaller than they need to be. A cut wherever a dart lands scores on average cc+2 of M2/2 after c cuts, against the best possible cc+1, so it needs about twice as many. A piece picked at random, whatever its size, is hopeless: the big pieces get picked no more often than the crumbs. All but the last row do finish, though (the random ones with probability 1), so every one of them gets to M2/2 in the end.

Atoms: where the counters come back

Now mix the two. Let some of the mass come in lumps that cannot be cut, atoms of sizes a1,…,aj, and the rest be a continuum you can cut as finely as you like. Finishing now means every atom ends up on its own and everything else is cut to nothing. The conserved quantity is the same, but ∑mi2 no longer goes to zero. It goes to ∑ak2, and the game is worth

M2−∑kak22

In the triangle, each atom keeps its own small triangle on the diagonal for ever: pairs of points inside one lump can never be pulled apart.

Atoms of 1 and 2 in a continuum of 3 make M=6, worth 36−52=31/2. Ground into grains, the continuum turns this into the weighted game from above, which the script plays every possible way, with the atoms in 4 different places:

Atoms of 1 and 2, the other 3 ground into grains
GrainEvery game scoresShort of 31/2 by
1/259/43/4
1/4121/83/8
1/8245/163/16
1/16493/323/32

Each grain size gives one total, whatever you do, and the gap to 31/2 is the grains' own small triangles, which vanish as the grains get finer.

The counters are the other end of the same formula: n atoms of size 1 and no continuum give n2−n2, the film's answer. The film's game and the bar are the two extremes, all atoms and no atoms at all.

Checking it

None of the above is left to the proofs. scripts/splits.mjs asserts every number on this page, and this page is built from what it writes.

Every way of splitting. The total depends only on the sizes in the tree of splits, so the totals reachable from a pile of n can be built up from the totals for smaller piles. The script does that for every n up to 49. Counters are told apart and any pile can be cut into any two parts, so seven counters can be played 10,395 different ways, and the last row is the forty-nine. Every row has exactly one total.

Every way of splitting, checked
CountersPairs, n(n−1)/2Ways to split themDifferent totals
2111
3331
46151
5101051
6159451
72110,3951
828135,1351
104534,459,4251
12661.37×10101
201908.20×10211
4911762.83×10741

Random games. Played out move by move, with a random pile and a random cut each time, and counted by the same rule as the film. Every game took exactly n−1 splits and landed on (n2).

Random games, played out
CountersGamesDifferent totals seenThe total
4920,00011176
10020,00014950
10002,0001499,500

The lab. The lab above runs the functions in site/lib/splits-core.mjs, the same text the script imports. In 2,784 games on 2 to 30 counters, plain and weighted, played by all three players, the score plus the pairs still together is the same number after every split, every game ends on it, and every game on up to seven counters is played out in full. The bar is cut 45,648 times in 600 games and its score is (M2−∑mi2)/2 every time.

The continuous game. Bars are cut in 1000 random games by three kinds of player (any piece, the biggest piece, wherever a dart lands), and in every strategy on this page. The total is recomputed from the pieces and compared with (M2−∑mi2)/2 after 302,071 cuts in all, exactly in whole numbers wherever the cuts allow it, and no game ever beats the equal-pieces bound. Each panel of the figure is tested at 28,680 pairs, and every pair lies in exactly one rectangle or one leftover triangle. The atoms are played every possible way, with grains down to 1/16.

The film's own two plays on seven counters are run through the same game.ts the episode is drawn from: products 12, 2, 1, 4, 1, 1 and 6, 5, 4, 3, 2, 1, and the blocks they lay on the triangle cover all 21 cells once.

Where this shows up

  • Round robins and networks. n teams, everyone plays everyone once: (n2) games, the same count as the links in a network where every node is joined to every other. Cut that network into two parts and the links you cut are ab of them.
  • Merge sort and inversions. Counting inversions by merge sort tallies, at each merge, the pairs that straddle the two halves. For a list in reverse order every straddling pair is an inversion, so the tally is ab at each merge and the total is (n2) wherever you cut. The script runs it on a reversed list of 100 with random cut points, 50 times: 4950 inversions every time.
  • Hierarchies. In any family tree of splits, such as a clustering of data points or the way species branch, every pair of leaves has exactly one place where they part company. The products of the two sides at each branching point add up to the number of pairs.

Try it yourself

1. Why do you always write down exactly n−1 numbers?

Each split turns one pile into two, so the number of piles goes up by one. You start with one pile and finish with n, so there are n−1 splits. Same reason a chocolate bar of n squares always takes n−1 breaks.

2. Write down the sum a+b instead of the product. Does the total depend on how you split?

It does. For seven counters the smallest total is 20 (split as evenly as you can) and the largest is 27 (peel one off at a time). In general, with k=⌊log2n⌋, the smallest is nk+2(n−2k) and the largest is n(n+1)2−1. For 49 counters that is anything from 279 to 1224, and nothing like a single number.

Score a+b and the total depends on how you split
CountersSmallest totalLargest totalScore ab always gives
2221
3553
4896
5121410
6162015
7202721
8243528
12447766
1664135120
4927912241176
3. Prove the several-piles version.

Same argument as proof one. A move that cuts a pile into parts p1,…,pk pulls apart every pair that ends in different parts, and a pair that is pulled apart is never pulled apart again. Write down those pairs and you count each pair of counters once.

4. Run it backwards: start with n single counters, join two piles at a time, and write down the product of the two sizes. What is the total?

The same. Play any game in reverse and every product is unchanged, so the total is (n2) whatever you join.

5. On the bar, cut every piece in the ratio 1 : 2, round after round. What is the score after k rounds, and how many rounds until it is within 1% of M2/2?

A piece of m becomes m/3 and 2m/3, whose squares add up to 19m2+49m2=59m2. So every round multiplies ∑mi2 by 59, and after k rounds

score=M22(1−(59)k)

It is within 1% after 8 rounds and 255 cuts, against 7 rounds and 127 cuts for halving. Cutting every piece in the ratio r:1−r multiplies ∑mi2 by r2+(1−r)2, which is smallest at r=12, so of all the round-by-round strategies halving is the fastest.

6. The film's 49 counters score 1176, but a bar of length 49 is worth 492/2=1200.5. Where did the other 24.5 go?

Into the counters. Each one is an atom of size 1, so it keeps its own triangle of area 12 on the diagonal: the pairs of points inside one counter, which no cut is allowed to separate. 49 of them make 24.5, and in general

n22−n2=n(n−1)2

They are the halves of the diagonal squares that the film's triangle of cells leaves out.