GG: The Monkey and the Coconuts - a Mathematical Problem

3 Conversations

Gnomon's Guide

On 9 October 1926, a puzzle concerning sailors, coconuts and a monkey was published in the Saturday Evening Post, an American magazine. It was contributed by Ben Ames Williams. The magazine received over 2,000 letters over the following week from frustrated readers who could not work out the number of coconuts. The editor, Horace Latimore, famously fired off a telegram to Williams: 'FOR THE LOVE OF MIKE, HOW MANY COCONUTS? HELL POPPING AROUND HERE'.

The Problem

Five sailors and their monkey went gathering coconuts on a tropical island. At the end of the day, they had collected a huge number. Worn out after their labours, they decided they would sleep and leave the task of dividing the coconuts until the morning.

In the middle of the night, one of the sailors awoke and decided that he didn't want to wait until morning, so he counted the coconuts, and divided the number by five. He found that there was one left over, so he tossed one coconut to the monkey (who scampered off with it), took his fifth of the total, and hid it elsewhere on the island. He then went back to bed.

Later in the night, the second sailor awoke. He also wanted his share now, so he did as the first sailor had done: counted the coconuts, divided them by five, found there was one left over, gave a coconut to the monkey, took his fifth share and hid it away. He then went back to sleep.

The third, fourth and fifth sailors each proceeded to do exactly the same, in each case dividing by five, tossing one to the monkey and taking what they regarded as their fair share.

In the morning, the pile of coconuts was much smaller, but no sailor wanted to admit they had been near it during the night, so they divided it into five equal shares.

How many coconuts were there to start with? In fact there's an infinite number of possible solutions, but which is the one with the minimum number of coconuts?

The Solution

This is not an easy problem. We need to assign a few variables:

  • Let N be the total number of coconuts collected.
  • Let A be the number taken away during the night by the 1st sailor.
  • Let B be the number taken away by the 2nd sailor.
  • Let C be the 3rd sailor's share
  • Let D be the 4th sailor's share.
  • Let E be the 5th sailor's share.
  • Let F be the number each sailor got in the final divvy in the morning.

We can write the following six equations:


5 A + 1 = N

5 B + 1 = 4 A

5 C + 1 = 4 B

5 D + 1 = 4 C

5 E + 1 = 4 D

5 F = 4 E

These can be manipulated and rearranged to get a single equation:


15625 F + 8404 = 1024 N

This is what is called a Diophantine equation, where the solutions must be whole numbers. There are laborious techniques for solving such equations, but they can often be figured out just by a bit of poking around and careful thought. We'll tackle this step by step:

  • What we are looking for is a whole number F such that (15625 F + 8404) is a multiple of 1024.

  • If this is a multiple of 1024, then we can subtract 1024 from it as many times as we like and still get something which is a multiple of 1024. Taking 8 times 1024 away, we can conclude that 15625 F + 212 is a multiple of 1024.

  • Taking a further 15 F times 1024 away, we find that 265 F + 212 is a multiple of 1024.

  • Now we notice that 53 is a factor of both 265 and 212, so 53×(5 F + 4) is a multiple of 1024.

  • 53 and 1024 share no common factors, so (5 F + 4) must be a multiple of 1024. The smallest such value is when (5 F + 4) = 1024.

  • This means that F must equal 204, and this gives us a value for N of 3121.

So the sailors must have collected 3,121 coconuts. No wonder they were so tired!

Martin Gardner's Mathematical Games

From 1957 to 1980, the magazine Scientific American had a monthly column called Mathematical Games, edited by recreational mathematician Martin Gardner (1914-2010). The puzzle of the Monkey and the Coconuts was his favourite. He presented it in his column in April 1958, and it was published in book form in The Second Scientific American Book of Mathematical Puzzles and Diversions, known in the UK as More Mathematical Puzzles and Diversions.

Gardner pointed out that Willams hadn't invented the puzzle but had taken an existing puzzle and modified it slightly to make it harder. In the original puzzle, when the morning arrived and the sailors divided up the final pile, there was one coconut left over, so they gave it to the monkey. This apparently trivial difference makes the puzzle easier to solve. The sixth equation becomes 5 F + 1 = 4E, giving 15625 F + 11529 = 1024 N. This reduces to 265*(F+1) being a multiple of 1024, for which the solution is clearly F+1 = 1024 or F=1023. This gives a value of 15621 for the total number of coconuts, much bigger than in Williams's version of the puzzle.

Gardner also reported an elegant solution to the original puzzle involving negative numbers. This was attributed to physicist Dirac (as in Fermi-Dirac Statistics), who claimed he got it from Whitehead (as in Principia Mathematica by Russell and Whitehead), who 'got it from someone else'. Clearly recreational mathematics has a long history. If we allow negative numbers of coconuts as well as positive ones we find that there is a very simple solution. If F is -1, then N is -4. This is the way the story plays out:


The sailors collected -4 coconuts, that is, four negative coconuts. This can also be treated as 5 negative coconuts plus 1 positive one. In the night, the first sailor tossed the positive coconut to the monkey, leaving -5. He divided these evenly into five groups of -1 each, took his negative coconut, leaving a pile of -4, the number he started with. Each sailor in turn came and repeated the process. In the morning, they divided the pile again, taking -1 each and giving +1 to the monkey.

If we find values of F and N that satisfy the equation, we can add 1024 to F and we will have another possible solution. Applying this to the negative solution, we get F = 1023 and N = 15621, which is the solution we already found.

Gardner also pointed out that problems such as these were studied by the 9th-century Indian mathematician Mahavira in his Ganita-sara-sangraha (c850 AD). This is the earliest Indian text devoted to mathematics.


Bookmark on your Personal Space


Entry

A882498

Infinite Improbability Drive

Infinite Improbability Drive

Read a random Edited Entry


Written and Edited by

Disclaimer

h2g2 is created by h2g2's users, who are members of the public. The views expressed are theirs and unless specifically stated are not those of the Not Panicking Ltd. Unlike Edited Entries, Entries have not been checked by an Editor. If you consider any Entry to be in breach of the site's House Rules, please register a complaint. For any other comments, please visit the Feedback page.

Write an Entry

"The Hitchhiker's Guide to the Galaxy is a wholly remarkable book. It has been compiled and recompiled many times and under many different editorships. It contains contributions from countless numbers of travellers and researchers."

Write an entry
Read more