Problem 5 of the IMO was definitely the most interesting problem in the contest, although one of the harder ones. A mere 37 people out of 511 managed to solve it completely.

What made it so different was that it did not require any particular knowledge on olympiad math theorems, indeed such knowledge would be useless for this problem. It required only creative insight, and quite a bit of it. Technically it’s a combinatorics problem, but no specific combinatorics experience is needed to solve the problem.

Also this problem was the target for a mini-polymath project organized by Terry Tao, which took about two and a half hours to get from start to solving the problem. The solution I’ll give is mostly based on the polymath solution, although I came up with my own finishing steps which I think is less awkward.

### Problem

In each of six boxes there is initially one coin. There are two types of operation allowed:

**Type 1**: Choose a nonempty box with . Remove one coin from and add two coins to .

**Type 2**: Choose a nonempty box with . Remove one coin from and exchange the contents of (possibly empty) boxes and .

Determine whether there is a ﬁnite sequence of such operations that results in boxes being empty and box containing exactly coins. (Note that .)

### Initial observations

It is not entirely obvious how this problem should be approached; thus we will begin by playing with it and jotting down any interesting observations.

We begin with one coin in each box. For convenience, I will express this as

.

We need to have

Again for convenience, let us substitute

.

Now we can express the two types of moves in our new notation. First, Type 1 moves (we shall call it Move 1):

.

Next, Type 2 moves:

.

Notice how applying Move 1 adds one coin to the system as a whole, while Move 2 takes away one coin.

By applying Move 2 over and over, it is easy to **remove **arbitrarily large amounts of coins from the system (as long as the coins are in the first four boxes).

On the other hand, it isn’t so clear how do **add **large amounts of coins to the system.

Applying Move 1 adds a coin to the system, so logically adding coins should be done by repeated usage of Move 1.

Given , applying Move 1 results in ; applying it again results in . We can repeat this as many times as we like, or until the first box is depleted.

This creates a **compound move** for a pair, executed by applying Move 1 repeatedly:

.

What if we apply this on all six boxes? We first get

Next we have

;

A few more iterations and we will have:

.

We are far from our target: we have 63 coins and we’re stuck. There doesn’t seem to be any other way to introduce any more coins into the system.

The problem seems hopeless.

### Building up a repository of compound moves

We first need a way of getting a large amount of coins into the system. From there is is easy to reduce the coins.

The compound move explained in the previous section is a first step. Let’s call it** Compound Move 1**:

.

The next compound move is less obvious. Suppose that we start with

.

Applying Move 1 gives us

which, using Compound Move 1, can be used to get

.

Now we apply Move 2. Using up a coin to switch the two boxes, we have

Or equivalently,

.

We can repeat this: switching, doubling, switching again, and so on, until the first box is depleted. This gives us

.

So here we have **Compound Move 2**:

.

This is a lot better than what we had before. However, it’s still a while towards our goal.

With Compound Move 1, each additional coin in the left most box adds 2 coins to the next box.

But with Compound Move 2, each additional coin **doubles **the result in the next box.

Now this problem has a *Towers of Hanoi* feel to it. It turns out that we can take this one step further, which, when examined closely, looks remarkably similar to the previous case.

Suppose we have

.

in four consecutive boxes. Applying Move 1:

.

Applying *Compound *Move 2 using the last three boxes, we get

.

Now we apply Move 2 and switch the boxes:

.

If we do this again, we get

.

So, repeating this many times until the left box is empty gives us

.

No doubt the number we have is sufficiently big now. We will call this move **Compound Move 3**, which can only be expressed reasonably with Knuth’s up-arrow notation:

.

### Putting it together

The configuration we want is

which is equivalent to

.

It’s relatively easy to get most of the boxes empty except for the third. From the starting position, Move 1 gives us

Applying Move 2 three times gives us

;

Move 1 then gives

.

We invoke Compound Move 3, getting

.

Finally we can waste coins by consecutively executing Move 2 until we have

And we’re done.

### An additional note

It is easy to show, albeit informally, that . If we take the binary log (I’ll write it as ) of both sides, we have

.

It’s okay to ‘throw away’ the 2, considering the magnitude of the numbers. Taking the log again:

.

Considering that , and the right hand side evaluates to just a few thousand, it’s fairly safe to say which is bigger.