I most recently encountered the ‘the monkey and the coconuts’ puzzle and it took me for a ride. I traced its modern version back to a 1926 issue of The Saturday Evening Post in the form of a short story by Ben Ames Williams titled “Coconuts”.
In this short story, a certain builder is engaged in competition with another builder for the same contract. The builder is keen to do everything he can to prevent his competition from bidding. A clever employee of the builder comes up with an ingenious plan. He is aware of the competitor’s craze for mathematical puzzles and aims to take advantage of it.
The employee sends the ‘the monkey and the coconuts’ puzzle over to the competitor. The competitor in turn ends up getting so obsessed over this puzzle that he forgets to enter his bid on time.
From my experience, I can only empathise with this competitor, for ‘the monkey and the coconuts’ puzzle is not to be taken lightly (you have been warned). Without any further ado, let us begin.
This essay is supported by Generatebg
The Background of the Monkey and the Coconuts
The Shipwreck
The story behind the puzzle begins with a shipwreck around noon. Luckily, all the ship’s occupants survive the catastrophe and wash up on the shore of a nearby island in the afternoon. The survivors include five sailors and a monkey.
In order to ensure further sustenance, the five sailors go about collecting coconuts on the island before nightfall. As they do this, the monkey cheers them on. After a tiresome effort, they pile a handsome stack of coconuts on the beach. At the end of the intense exercise, they all decide to go to sleep.
The Ploy
As everyone sleeps, one sailor gets anxious about the thought of a quarrel about splitting the coconuts in the morning. He gets up and divides the stack into five equal piles with one extra coconut left over. By this time, the monkey is also awake and looks at him peculiarly. So, the sailor throws the left-over coconut to the monkey (perhaps as a bribe?). He takes one of the five equal piles for himself, hides his stash, reorganises the remaining piles into one big (new) pile, and goes to sleep.
Shortly after, another sailor wakes up with the same worry and divides the pile of remaining coconuts into five equal piles. He too is left with one extra coconut. Like the first sailor, he also throws the extra coconut to the monkey, takes and hides one of the five piles for himself, reorganises the remaining piles into one big pile, and goes back to sleep.
Similarly, one after another, the three remaining sailors get up and go through the same procedure. And the monkey gets an extra coconut each time around.
The Monkey and the Coconuts Puzzle
Finally, the following morning, everyone wakes up to a considerably smaller pile. They all realise that there has been some mischief going on, but none of them utters a word, as each of them is guilty of mischief himself.
They decide to split the coconut stack into five equal piles for each one of the sailors. They are indeed able to do this and are yet again left with one extra coconut. They throw the extra coconut to the monkey and proceed with their day.
Now, the question posed by the puzzle is:
How many coconuts in total did the sailors originally collect?
Hint:
This puzzle has more than one solution, mathematically speaking. However, we are looking for the least number of total coconuts that would allow for the events of the story to logically occur. Also, a word of caution: This puzzle is considerably harder than it looks.
Spoiler Alert:
If you wish to try to solve the puzzle on your own, now is the time. Once you have given it a good try, you may choose to continue reading. From this point onwards, I will be explicitly discussing the puzzle’s solution.
Transforming Facts into Equations
Let us say that right at the beginning, there are a total of ’N’ coconuts in the stack. Furthermore, let ‘A’ be the number of coconuts that the first sailor chose to hide. Similarly, let ‘B’, ‘C’, ‘D’, and ‘E’ be the number that each sailor following the first sailor chose to hide respectively.
Finally, let ‘F’ be the total number of coconuts that each sailor got in the morning after the split. Then, we arrive at the following equation system:
The ‘1’ on the right-hand side of each equation represents each time the monkey gets a coconut. So, the monkey ends up with a total of 6 coconuts by the morning. Now that we have an equation set, we could proceed with simplifying them.
Simplifying the Equation Set
Before you proceed with reading this section, know that this is just cumbersome mathematical simplification. If you feel pressed for time or just wish to cut to the chase, you may choose to skip this section. However, if you want to get into nitty-gritty mathematics, go right ahead.
When we substitute equations 2, 3, 4, 5, and 6 into 1, we get the following result:
That looks like a messy equation. But worry not; it simplifies into something far less messy:
Solving the Monkey and Coconuts Puzzle
After a bit of mathematical acrobatics, we have arrived at a single equation with 2 unknowns: the total number of coconuts right at the beginning, and the final number of coconuts each sailor gets in the morning. What is more challenging is the fact that this is a Diophantine equation.
Diophantine Equation → 1024N – 15625F – 11529 = 0
If you are not aware of the notion of Diophantine equations, just know that it is a special class of equations where we accept only integer solutions (named after Diophantus of Alexandria, the pioneering Greek algebraist).
There are several formal procedures that we could follow (including trial and error) to solve this equation. But in this essay, I will be demonstrating a simple yet counterintuitive approach to solving the puzzle. Just as a reminder:
We are looking for the least number of total coconuts that would allow for the events of the story to logically occur.
Thinking Negatively to Solve the Monkey and the Coconuts Puzzle
The sailors, in summary, divided ’N’ coconuts into five piles a total of 6 times. This means that 5⁶ coconuts can be added or subtracted to ’N’ to achieve an infinite number of solutions. But our goal is to come up with the least positive integer solution possible.
In order to achieve this, Paul Dirac came up with an ingenious approach (he in turn attributed the credit to an unknown source). It is quite clear that the least positive integer solution will not be a small number.
But what if there is a small negative integer that satisfies the equation?
It turns out that there does indeed exist one such integer: -4. And this is how the sequence plays out:
1. The sailors first amass a total of -4 coconuts.
2. Once everyone else is asleep, the first sailor tosses a positive coconut over to the monkey. In this instance, a negative coconut is created. When summed up with the common pile, there are now a total of -5 coconuts.
3. The sailor splits the -5 coconuts into -1 coconut per sailor, takes and hides his stash (-1 coconut), reorganises the remaining -4 coconuts into the common pile, and goes to sleep.
4. Then, the next sailor wakes up and repeats the entire cycle. Therefore, at the end of each cycle, the number of coconuts goes back to -4 (the same number we started with).
Notice how there is a subtle change in the order of events in this approach to the puzzle. If the sailor had decided to split the -4 coconuts into five piles first before tossing one positive coconut to the monkey, we would have ended up in trouble.
We need to consider this order change because we are working with negative coconuts here. However, this change in order does not affect our final solution, as you are about to find out.
The Solution to the Monkey and the Coconuts Puzzle
Let me recall our main realization about the puzzle from earlier:
“The sailors, in summary, divided ’N’ coconuts into five piles a total of 6 times. This means that 5⁶ coconuts can be added or subtracted to ’N’ to achieve an infinite number of solutions.”
We just established that -4 is a valid negative solution to the puzzle. Considering our main realisation, we could just add 5⁶ to this result. This way, we will arrive at the answer we are looking for!
Therefore, the lowest positive integer solution to our puzzle is:
-4 + 15625 = 15621.
References and credit: Martin Gardener and Ben Ames Williams.
If you’d like to get notified when interesting content gets published here, consider subscribing.
Further reading that might interest you: The Shipwreck Puzzle — A Fun Linear Math Challenge and How To Really Solve The Three 3s Problem?
If you would like to support me as an author, consider contributing on Patreon.
Comments