"The Monkey and the Coconuts" is a classic Diophantine problem.
Three sailors and a monkey were shipwrecked on a desert island. The sailors worked all day to collect coconuts, but were too tired that night to count them. They agreed to divide them equally the next morning. During the night, one sailor woke up and decided to get his share. He found that he could make three equal piles, with one coconut left over, which he tossed to the monkey. Thereupon he had his own share and left the remainder in a single pile,
Later that night, the second sailor awoke and, likewise, decided to get his share of coconuts. He also was able to make three equal piles, with one coconut left over, which he tossed to the monkey. Somewhat later, the third sailor awoke and did exactly the same thing with the remaining coconuts, making three equal piles, taking his share and tossing the leftover coconut to the monkey.
In the morning, all three sailors noticed that the pile was considerably smaller, but each thought that he knew why and said nothing. When they then divided the remaining coconuts equally, each sailor received seven and one was left over, which they tossed to the monkey.
How many coconuts were in the original pile?