Skip to content
Vamshi Jandhyala

Books · Number Puzzles

Chapter 30

The Coconuts and the Monkey

Five castaways spend a day gathering coconuts into one pile, meaning to share them out next morning. A monkey watches. In the night one man wakes, distrusts the others, and divides the pile into five equal heaps; one coconut is left over, which he tosses to the monkey. He hides his own heap and pushes the other four back into a pile. One by one each of the other four does exactly the same: divides into five, finds one left over for the monkey, hides a fifth, restores the rest. In the morning the pile that remains divides evenly among the five, with none left over. What is the smallest number of coconuts they could have started with?

Solution

The smallest pile is 31213121.

The clean way to see it uses a borrowed idea: a pile of 4-4 coconuts. Watch what the night-time operation does to such a pile. Take away one for the monkey, leaving 5-5; remove a fifth of that, namely 1-1, and four heaps of 1-1 remain, a pile of 4-4 again. So 4-4 is left utterly unchanged by the whole procedure. It follows that if the real pile NN is such that N+4N + 4 is divisible by enough fives, the arithmetic stays whole at every step. Five nights of dividing call for five factors of five, so set N+4=55=3125,N=3121.N + 4 = 5^5 = 3125, \qquad N = 3121. Then each man in turn finds a pile one more than a multiple of five, and after all five have taken their share the morning pile is 454=10204^5 - 4 = 1020, which divides evenly by five into 204204 each. No smaller pile works.

The same trick handles the variations. For four castaways the smallest pile is 765765; and for the harder case of seven castaways who leave three coconuts for the monkeys at each stage, it is 24706112470611.