Exercise 6. In 5 boxes are found respectively $402, 403, 404, 405$ and 406 stones. The only allowed operation is to take 4 stones from a pile that has at least 4 stones and to put one in each of the other piles. What is the maximum number of stones that can be in a single pile?
Solution to Exercise 6 The statement presents a sequence of operations and describes a certain initial situation. A first idea to try in this case is to look for an invariant.

A second idea is to test the statement for smaller values, for example for piles of size $0,1,2,3$ and 4. After several trials, one notices that the piles always have, up to permutation, the sizes $0,1,2,3$ and 4. After testing on piles of size $1,2,3,4$ and 5, one realizes that the piles always have distinct values modulo 5. One hastens to prove this conjecture.

Removing 4 stones from a pile is equivalent, modulo 5, to adding 1. Since one adds one stone to each of the other piles, the values of the piles all increase by 1 modulo 5. Thus, if before the operation these values were distinct modulo 5, after the operation they will remain distinct modulo 5. We have thus determined our invariant.

Thus the sum of the sizes of any 4 piles will never exceed $0+1+2+3=6$ and therefore no pile will ever contain more than $2020-6=2014$ stones.

Conversely, we now need to prove that it is always possible to ensure that a pile contains 2014 stones after a finite number of operations. For this, it suffices to never touch the pile containing 404 stones, and to perform the operation on the other piles until it is no longer possible to perform a single operation. Thus the remaining piles will have $0,1,2,3$ stones at the end of the process, so there will indeed be $2020-(0+1+2+3)=2014$ stones on the same pile.

Graders' Comments

Many students are content with constructing the bound without showing that it is indeed optimal. In rarer cases, some students prove only the minimality without the attainability. Most proofs of optimality are based on work modulo 5, but some more original proofs do without, with work on the last operations (rarely perfectly executed).