Sailors and Coconuts
Three sailors were marooned on a deserted island that was also inhabited by a band of monkeys. 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 take his share. He found that he could make three equal piles, with one coconut left over, which he threw to the monkeys. Thereupon, he put his own share in a pile down the beach, and left the remainder in a single pile near where they all slept.
Later that night, the second sailor awoke and, likewise, decided to take his share of coconuts. He also was able to make three equal piles, with one coconut left over, which he threw to the monkeys.
Somewhat later, the third sailor awoke and did exactly the same thing with the remaining coconuts.
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 what was left of the original pile of coconuts equally, each sailor received seven and one was left over, which they threw to the monkeys.
How many coconuts were in the original pile?