You are here

Monkey and coconuts puzzle with solutions

Monkey and Coconuts Problem: Solution to Two Riddles

Monkey and Coconuts problem, the evergreen math puzzle and easy solution to two riddles

5 men and a monkey in an island collect coconuts first day. During night, 1 man wake up, divide coconuts into 5 piles, keep 1 pile...Enjoy easy solutions.

Monkey and coconuts problem is one of the most popular and actively pursued math puzzles over nearly a century after short story writer Ben Williams modified an older problem to make it more difficult and published the modified version in Saturday Evening Post as part of a story as far back as 1926.

We will first solve the original puzzle that was later modified and made more difficult by Ben Williams.

This strategy follows the well-known Problem solving technique of Solving a simpler problem first.

Monkey and coconut problem, Original version

From the Wikipedia version of the puzzle, we produce the older original puzzle as,

Five men and a monkey were shipwrecked on an island. They spent the first day gathering coconuts. During the night, one man woke up and decided to take his share of the coconuts. He divided them into five piles. One coconut was left over, so he gave it to the monkey, then hid his share and went back to sleep.

Soon, a second man woke up and did the same thing. After dividing the coconuts into five piles, one coconut was left over which he gave to the monkey. He then hid his share and went back to bed. The third, fourth, and fifth man followed exactly the same procedure. The next morning, after they all woke up, they divided the remaining coconuts into five equal shares. This time also 1 coconut was left. What is the smallest number of coconuts that could have been there in the original pile?

While you enjoy solving the simpler version of the puzzle, we will tell you a little more about the life history of the Ben Williams version of the puzzle in which he made the slight change in the final stage. Instead of 1 coconut left over at the end, he changed it to "with no coconut left over" (Wikipedia reference: The coconut and the monkey puzzle).

This made the puzzle more difficult and intriguing to solve.

Try to solve this harder version of the puzzle as well.

Writer Ben Williams didn't include the answer or the solution to the puzzle that was reportedly very difficult but interesting, so much so that,

The magazine was inundated by more than 2,000 letters pleading for an answer to the problem. The Post editor, Horace Lorimer, famously fired off a telegram to Williams saying: "FOR THE LOVE OF MIKE, HOW MANY COCONUTS? HELL POPPING AROUND HERE". Williams continued to get letters asking for a solution for the next twenty years. (ref: Wikipedia).

The puzzle was highly valued by the legendary mathematician and puzzler Martin Gardner who contributed to its popularity by featuring it in Scientific American and in some of his famous books. He went on to say that, The Monkey and the coconuts puzzle is "probably the most worked on and least often solved" algebraic puzzle. It is classified as a Diophantine algebraic puzzle.

Following is our solution of the original puzzle in which we have used School level basic math and it should be easily understandable to all.

This being a classic math puzzle, there can be other ways to arrive at the solution, and more importantly, if you try to solve the puzzle yourself, you would enjoy the solution more.

Solution to Monkey and coconut problem, original version

Let us repeat here, we are averse to using advanced mathematics for solving puzzles and so we always try to find out solutions based on simpler patterns and methods that would be clear to most people.

Let us repeat the puzzle for ease of reference.

Monkey and coconut problem (coconut riddle)

Five men and a monkey were shipwrecked on an island. They spent the first day gathering coconuts. During the night, one man woke up and decided to take his share of the coconuts. He divided them into five piles. One coconut was left over, so he gave it to the monkey, then hid his share and went back to sleep.

Soon, a second man woke up and did the same thing. After dividing the coconuts into five piles, one coconut was left over which he gave to the monkey. He then hid his share and went back to bed. The third, fourth, and fifth man followed exactly the same procedure. The next morning, after they all woke up, they divided the remaining coconuts into five equal shares. This time also 1 coconut was left. What is the smallest number of coconuts that could have been there in the original pile?

Monkey and coconut problem: Solution stage 0: Division concepts and Division lemma in brief

Before we go any further, let us briefly remind you the age-old concept of division of one integer by a second, formally stated in his division lemma by Euclid,

$a=bq+r$,

where $a$, the larger number is the dividend, $b$, the smaller number is the divisor, $q$ is the quotient and $r$ is the remainder that can be 0 but must always be less than $b$, the divisor.

In a division of two integers, effectively we count number of times $b$ occurs in $a$. Naturally, in a division ALL occurrences of $b$ are taken out of $a$ and that's why the remainder $r$ must always be less than $b$. If remainder is 0, we say, $b$ divides $a$ fully leaving no remainder and so is a factor of $a$.

Briefly, this is what happens in a division of two integers.

This much math is to be absorbed to understand the solution. It can't be helped—after all, monkey and the coconuts is declared to be one of the least number of times solved puzzles! Isn't it?

Let's now get going with the solution.

Monkey and coconut problem: Solution Stage 1: Problem analysis and broad definition

Technique of any problem solving is to get to the heart of the problem, shedding all details that are not necessary for the solution.

So we ask our first question,

What did actually happen on six events of divisions?

This is the key question to answer.

If you think clearly with a neutral mind, you will quickly home in to the core activity that is repeated six times,

Six times, a number is divided by 5 with remainder 1.

Now we will ask the second question,

What is the number being divided?

The answer is also simple,

Four times the quotient of the previous division is the number that is divided in the current division, and at the start, the total number of coconuts itself is divided.

With these two facts in mind, we will quickly form the six simple equations representing the six divisions as,

$N=5q_1+1$, divided by the 1st man, one share of $q_1$ taken, leaving $4q_1$.

$4q_1=5q_2+1$, divided by the 2nd man.

$4q_2=5q_3+1$, divided by the 3rd man.

$4q_3=5q_4+1$, divided by the 4th man.

$4q_4=5q_5+1$, divided by the 5th man.

$4q_5=5q_6+1$, divided in 5 equal shares among the five men, each getting their final share as $q_6$ number of coconuts leaving 1 even at this stage.

The $q$'s are the quotients suitably labeled by the division number and the original number of coconuts is $N$.

Monkey and coconut problem: Solution stage 2: Identification of Key pattern and key method

Now stop briefly to analyze the six equations. Can you find a common pattern? Yes, each of the six equations has 1 coconut as the remainder.

This gives rise to the immediate possibility to,

Add 4 to make any of the six numbers on the left hand side, say, $4q_4$ plus 4, a factor of 5.

We identify this as the key method based on the key pattern. We will explain shortly why.

Monkey and coconut problem: Solution stage 3: Use of key method based on key pattern: Working backwards approach as the key strategy

Any difficult problem needs to be approached with proper strategy, and not randomness.

We identify Working backwards from the final sixth division towards the original first division following the powerful working backwards approach as the key strategy in this case.

Accordingly, we first add 4 to the sixth equation applying the key method to get,

$4q_5=5q_6+1$,

Or, $4q_5+4=5q_6+5$,

Or, $4(q_5+1)=5(q_6+1)$.

This is the crucial relation from which we conclude using factors multiples concepts, that $(q_5+1)$ must have a factor of 5.

Move up to the fifth equation and add 4 to it again to get,

$4q_4=5q_5+1$,

Or, $4q_4+4=5q_5+5$,

Or, $4(q_4+1)=5(q_5+1)$.

On the right-hand side, the coefficient 5 contributes one 5 and $(q_5+1)$ contributes a second factor of 5. So, $(q_4+1)$ must have a factor of $5^2=25$.

Continuing this way we conclude,

$(q_3+1)$ must have a factor of $5^3=125$,

$(q_2+1)$ must have a factor of $5^4=625$,

$(q_1+1)$ must have a factor of $5^5=3125$.

Now adding 4 to the first equation we have,

$N+4=5(q_1+1)$.

Monkey and coconut problem Solution final stage: Mathematical reasoning

We already know $(q_1+1)$ must have a factor of 3125. So $(N+4)$ must have a factor of $5\times{3125}=15625$.

If $(q_1+1)$ had factors other than 3125, all the conditions would still be valid, but in that case value of $(N+4)$ would be larger than when $(q_1+1)$ comprises only the single factor of 3125.

So, the smallest value of total starting number of coconuts $N$ will be given by,

$N+4=15625$,

Or, $N=15621$.


Testing the solution

By first division by 5,

$15621=5\times{3124}+1$.

Four shares of 3124 each, 12496 is divided into 5 shares by the second man,

$12496=12495+1=5\times{2499}+1$.

Four shares of 2499 each, 9996 is divided into 5 shares by the third man,

$9996=9995+1=5\times{1999} +1$.

Four shares of 1999 each, 7996 is divided into five shares by the fourth man,

$7996=7995+1=5\times{1599}+1$.

Four shares of 1599 each, 6396 is divided into five shares by the fifth man,

$6396=5\times{1279}+1$.

At the last stage, remaining four shares of 1279 each, 5116 is divided into five shares by all the five men together with 1 left out even at this last stage,

$5116=5115+1=5\times{1023}+1$.

Note that this division of 5 equal shares leaving 1 cannot be continued any further.


Now we are in a position to take on the modified version of the puzzle as published by Ben Williams.

Solution to modern version of monkey and coconut problem by Ben Williams

We will now produce the puzzle published by Ben Williams,

Five men and a monkey were shipwrecked on an island. They spent the first day gathering coconuts. During the night, one man woke up and decided to take his share of the coconuts. He divided them into five piles. One coconut was left over, so he gave it to the monkey, then hid his share and went back to sleep.

Soon, a second man woke up and did the same thing. After dividing the coconuts into five piles, one coconut was left over which he gave to the monkey. He then hid his share and went back to bed. The third, fourth, and fifth man followed exactly the same procedure. The next morning, after they all woke up, they divided the remaining coconuts into five equal shares. This time no coconuts were left over. What is the smallest number of coconuts that could have been there in the original pile?

In the same line as above we will present the six division relations as before. Only change will be in the last division.

$N=5q_1+1$, divided by the 1st man, one share of $q_1$ taken, leaving $4q_1$.

$4q_1=5q_2+1$, divided by the 2nd man.

$4q_2=5q_3+1$, divided by the 3rd man.

$4q_3=5q_4+1$, divided by the 4th man.

$4q_4=5q_5+1$, divided by the 5th man.

$4q_5=5q_6$, divided in 5 equal shares among the five men, each getting their final share as $q_6$ number of coconuts leaving no coconuts at this last stage (remainder 0).

Solution to modern version of Monkey and coconut problem by Mathematical Reasoning and Systematic enumeration

If we consider the problem to continue for five stages of division and not six (disregarding for the moment the last equation), the first five equations will represent the solution.

Here, minimum $N$ will be $5^5-4=3121$, and not $5^6-4=15621$.

Taking this cue, we shift our focus to the sixth equation,

$4q_5=5q_6$.

From factors multiples concepts, we conclude that $q_5$ must be a multiple of 5 as well as $q_6$ must be a multiple of 4.

If we work down from the minimum value of $N=3121$ for satisfying first five conditions, and can satisfy the last stage binding condition for solution, we know we got the answer.

The series of values for six stages with the smallest value of $N$ satisfying the first five relations we get,

$3121=5\times{624}+1$

$4\times{624}=2496=2495+1=5\times{499}+1$

$4\times{499}=1996=1995+1=5\times{399}+1$

$4\times{399}=1596=1595+1=5\times{319}+1$

$4\times{319}=1276=1275+1=5\times{255}+1$

$4\times{255}=5\times{204}$.

$q_5=255$ has a factor 5 as well as $q_6=204$ has a factor 4 and so 3121 is the smallest number that satisfies all the rest 5 conditions as well as the sixth condition.

The solution is,

3121 is indeed the solution to the monkey and coconuts puzzle as released by Ben Williams.

End note

The solution to the first original problem largely follows mathematical reasoning whereas for the modified version, not only did we take help of the experience of solving the more straightforward original puzzle but also had to take recourse to systematic enumeration along with mathematical reasoning.

This is Systematic problem solving with no random approach and an assured outcome of least cost easy to understand solution.


Know how to solve difficult problems easily without wasting time on random attempts

Our ebook on puzzle solutions by innovative methods will show you just that.

Puzzles for Adults eBook

Puzzles for Adults: 50 Brain Teasers with Step-by-Step Solutions: Boost Your Power of Problem Solving

(BUY from Apple books, Barnes & Noble, Rokuten Kobo, Vivlio, Angus & Robertson, Tolino, PayHip and others)

BUY the eBook Amazon Kindle version here, from Google Play here and Paperback here.


Puzzles you may enjoy

Easy to hard brain teasers with systematic solutions

Challenging brain teasers with solutions: Long list.

This will always be the most up-to-date full list with the brain teasers classified into categories that can be browsed separately.

You may also click on the category term link below to enjoy the brain teasers that are classified in the present category.

For example, if the category term link shown below is "Riddle", click on it to go through all the Riddles.