Skip to main content.

Solution to puzzle 7: Five men, a monkey, and some coconuts

Let the original pile have n coconuts.  Let a be the number of coconuts in each of the five piles made by the first man, b the number of coconuts in each of the five piles made by the second man, and so on.

Writing a Diophantine equation to represent the actions of each man, we have

n = 5a + 1 if and only if  n + 4 = 5(a + 1)
4a = 5b + 1 if and only if  4(a + 1) = 5(b + 1)
4b = 5c + 1 if and only if  4(b + 1) = 5(c + 1)
4c = 5d + 1 if and only if  4(c + 1) = 5(d + 1)
4d = 5e + 1 if and only if  4(d + 1) = 5(e + 1)

Hence n + 4 = 5 × (5/4)4 (e + 1), and so n = (55/44) (e + 1) − 4.

Note that, since 5 and 4 are relatively prime, 55/44 = 3125/256 is a fraction in its lowest terms.  Hence the only integer solutions of the above equation are where e + 1 is a multiple of 44, whereupon d + 1, c + 1, b + 1, and a + 1 are all integers.

So the general solution is n = 3125r − 4, where r is a positive integer, giving a smallest solution of 3121 coconuts in the original pile.


Remarks

It's clear from the form of the equations that we can generalize this result.  Given m > 2 men in the airplane, the smallest solution would be mm − (m−1) coconuts.  This follows because, for m > 2, m and m−1 are always relatively prime.  (Any divisor of m and m−1 must also divide their difference.)


Further reading

  1. Coconuts, by Ben Ames Williams
  2. Monkey and Coconut Problem
  3. "The Coconut Problem"; Updated With Solution

Source: Ben Ames Williams

Back to top