The following is a famous puzzle set by Ben Ames Williams in the Saturday Evening Post in 1926 – I’ve borrowed the telling from a New Scientist puzzle book I’m editing. It’s in a footnote. I’m sure it’s fine.

There are five sailors shipwrecked, and during the night, each sailor attempts to divide a pile of coconuts into five equal piles, but there is one coconut left over, which is given to the monkey. They then take one of the piles to hide it for themselves. After each sailor does their division, they awake in the morning and finally divide the remaining coconuts equally among themselves, with nothing left for the monkey. The question was, ‘How many coconuts were there in the beginning?’

The Post was so deluged with letters on the subject that the editor telegraphed Williams the immortal message:


Well, dear readers. Allow me to put the puzzle to bed once and for all. As usual, spoiler live below the line.

In each round, a sailor gives a coconut to the monkey and takes a fifth of the remainder. That’s really awkward to work with, but there’s a neat way around it. You can probably sense the smugness emanating from Flying Colours Towers as I write, even if you’re reading this many months in the future.

The trick is to borrow four coconuts from the monkey before you start.

If you do that, the first sailor would get an extra coconut (which he could give to the monkey), and the remaining pile would have four extra coconuts. If you repaid those to the monkey, the game would be in exactly the same state as if you’d done it the way the puzzle asks.

So it would make sense not to repay the monkey straight away, and instead follow the same procedure for the next four sailors – and then pay the monkey back.

What does that mean, mathematically? Our process is “add four to the original number, then multiply by $\frac{4}{5}$ five times, and subtract four to leave a multiple of 5”. That means our original number is four less than a multiple of $5^5$ – call it $3125N-4$. After the last sailor has snuck off and repaid the monkey, we’re left with $4^5 N - 4$, or $4(256N-1)$. That’s a multiple of 5 if $N$ is one more than a multiple of 5, so $N$ could be 1, 6, 11, …, $5k+1$, …

So, in general, there could be $3125(5k+1)-4$ coconuts to begin with, or $15625k + 3121$. The smallest integer solution is 3121.

If the editor of the Sunday Evening Post is reading ((The chances are, I would think, slim.)), I hope that helps!