This is a famous old problem. I shall just state the problem here for you, and will follow up in a day or two with a solution and some of its amusing history. Update: Scroll down for a straightforward solution and a “trick” solution.
There are also, by now, various generalizations and different versions. Here’s a basic version:
Five sailors are shipwrecked on a desert island. They quickly determine that the only other inhabitant of the island is a monkey and that the only food is coconuts. They set about collecting as many coconuts as they can and put them all in a very large pile. By nightfall they are too tired to divide the harvest; so they agree to go to sleep and share the coconuts equally the next morning.
During the night one sailor awakens, suspicious that the others might try to cheat him, and decides to take his portion then and there and not wait until morning. He divides the coconuts into five piles and finds there is one coconut left over, which he gives to the monkey. He hides one of the five piles, then puts the rest of the coconuts back into a pile and returns to sleep. Later a second sailor awakens with the same suspicions and does the same thing: He divides the coconuts into five piles, leaving one extra, which he gives to the monkey. Then he hides what he thinks is his share, puts the remaining coconuts into a pile and goes back to sleep.
One after the other, the rest of the sailors do the same: They each take one fifth of the coconuts in the pile (there is always an extra one, which is given to the monkey) and then return to sleep. When the sailors awaken the next morning they all notice the coconut pile is much smaller than it was the night before, but since each man is as guilty as the others, no one says anything. They divide the coconuts (for the sixth time) and again there is one left for the monkey.
How many coconuts were in the original pile?
If you’re interested, give it a good try, and resist the temptation to scour the internet for the solution.
Update: Here is a solution to the problem and a few comments.
Let x represent the number of coconuts in the original pile, and let y represent the number of coconuts that each sailor takes away in the morning.
Now, consider how many coconuts remain in the pile after the first sailor secretly takes a portion away to hide in the night. He tosses one coconut to the monkey, then takes a fifth of the rest, so the number of coconuts remaining in the pile is
Using the same reasoning, the number of coconuts that remains in the pile after the second sailor secretly removes some coconuts in the night is
Repeating the same argument three more times, the number of coconuts left in the pile in the morning, before the final sharing, is
In the morning, one coconut gets thrown to the monkey, and the remaining coconuts are shared equally five ways. Thus, each sailor receives (besides the ones taken in the night) an additional y coconuts, where
So, we end up with one equation for two unknowns, which seems not to be solvable. Or rather, there are an infinite number of solutions, about which it seems that no more can be said. However, we have one additional piece of information that has not been used yet: The values of x and y must be whole numbers. That is, the number of coconuts in the pile, and the number taken at any stage, is assumed to be a whole number.
This is part of the reason that mathematics problems are difficult. There are tacit assumptions that one must identify and then translate into mathematical language.
Equations such as the one under consideration are called Diophantine equations, and were studied in antiquity.
I first learned about this problem from a colleague about 25 years ago, when he gave it to me as a challenge. A few years ago I bought the wonderful Martin Gardner book entitled The Colossal Book of Mathematics, and I was delighted to see this problem was the subject of his very first item. He mentions that the problem was first published as part of a short story in the 9 October 1926 issue of The Saturday Evening Post, written by Ben Ames Williams. The offices of the periodical were inundated by 2000 pieces of mail in the first week alone, prompting the editor to send a famous telegram to the author, which read
For the love of Mike, how many coconuts? Hell popping around here.
Gardner goes on to say that the author continued to receive letters about the problem for more than twenty years!
Gardner boils down the last equation above to
and goes on to say that the equation is far too difficult to solve unless a clever trick is used. But there is a nice way to solve the equation, which I will now show you. Expand the equation to get
Notice that the quantity in square brackets is a geometric series, and can be expressed in a compact and useful form using the results of my previous post. The result is
A little algebraic manipulation, including clearing the fractions, will be helpful:
OK, this looks a lot simpler, but it still may not be clear how to make progress. But remember, x and y must be whole numbers. This means that each side of the previous equation is a whole number. How can the two whole numbers represented by each side of the equation possibly be equal? There are six factors of 5 on the left side of the equation, but where are they on the right? The only way this will work is that
must be a multiple of .
And this solves the problem. There are indeed an infinite number of solutions, but we now know all of them. The smallest solution is
the next largest is
and so on. For each value of x, the corresponding value of y is obtained by solving the equation
An alternative “trick” solution
Gardner’s solution involves the following trick. Notice that if it were possible to find one solution, all other solutions would differ from it by a multiple of . Then (and this is the genius part), notice that is a solution. What?? A negative number of coconuts??
I don’t think I would ever have noticed this, but once you have been told it, and with the benefit of our equation
it’s clear that and makes both sides of the equation 0. Does this make sense? Sort of: If there are coconuts in the original pile, and one is thrown to the monkey, leaving in the pile, then when a sailor takes one-fifth of the coconuts (that would be coconuts), then coconuts remain. Each of the sailors do this in turn, and in the morning the sailors are confronted with a pile of coconuts, and after they toss one to the monkey, they can evenly divide the pile by taking coconut each.
But in certain problems a standard idea is to look for “fixed-point” solutions. If we were to do this here (that is, imagine a number of initial coconuts such that after the first sailor’s withdraw yields the same number of coconuts in the pile) we would be led to the equation
the solution of which is
So does it require genius or not? I don’t know.
In any case, legend had it that Dirac was the one who thought up this delightful trick, so Gardner wrote to Dirac to inquire whether this was the case. He said that he heard the negative solution from the mathematician J.H.C. Whitehead. Gardner wrote to him as well, but Whitehead said that he had heard the negative solution from someone else, and Gardner gave up the trail at that point.
Check the Gardner book for generalizations and further literature on this problem if you’re interested in digging deeper.