Coconuts Driving Me Nuts: Solution

Let us suppose there had been "x" number of coconuts initially.

The first friend finds that the number is not a multiple of five, and so has to give one away to the monkey. So, now there are x-1 coconuts. He, then, takes one-fifth of his share and what remains is 4(x-1)/5 coconuts.

The second friend gives one coconut to the monkey. The number of coconuts that remains is 4(x-1)/5 - 1, or (4x - 9)/5. He takes his one-fifth share, and the number of coconuts left is 4/5 [(4x - 9)/5], or (16x - 36)/25.

The third gives one coconut to the monkey, so the number of coconuts remaining is (16x - 36)/25 - 1, or (16x - 61)/25. He takes one-fifth of his share. The number of coconuts that are left is 4/5 [(16x - 61)/25], or (64x - 244)/125.

Now it is the fourth friend's turn. He gives away one coconut to the monkey which leaves (64x - 244)/125 - 1, or (64x - 369)/125 coconuts. He takes one-fifth of his share and so four-fifths of (64x - 369)/125 remain. The number of nuts remaining is, therefore, 4/5 [(64x - 369)/125], or (256x - 1476)/625.

Finally, we come to the fifth friend. He gives away one coconut to the monkey and that leaves (256x - 1476)/625 - 1, or (256x - 2101)/625. He takes on-fifth of his share, or 1/5 [(256x - 2101)/625], or (256x - 2101)/3125.

Now, one-fifth of the share is 255. Therefore, (256x - 2101)/3125 = 255.

So, 256x - 2101 = 796875.

Thus, 256x = 798976. So, x = 3121. There were, therefore, 3121 coconuts initially. Did I get that right?