An official website of the United States government
Here's how you know
A .gov website belongs to an official government organization in the United States.
A lock (lock ) or https:// means you’ve safely connected to the .gov website. Share sensitive information only on official, secure websites.

News | June 21, 2016

June 2016 Puzzle Periodical

By Robert B., NSA Applied Mathematician

Following their latest trip, the 13 pirates of the ship, SIGINTIA, gather at their favorite tavern to discuss how to divvy up their plunder of gold coins. After much debate, Captain Code Breaker says, “Argggg, it must be evenly distributed amongst all of us. Argggg.” Hence, the captain begins to pass out the coins one by one as each pirate anxiously awaits her reward. However, when the captain gets close to the end of the pile, she realizes there are three extra coins.

After a brief silence, one of the pirates says, “I deserve an extra coin because I loaded the ship while the rest of you slept.” Another pirate states, “Well, I should have an extra coin because I did all the cooking.” Eventually, a brawl ensues over who should get the remaining three coins. The tavern keeper, annoyed by the chaos, kicks out a pirate who has broken a table and who is forced to return her coins. Then the tavern owner yells, “Keep the peace or all of you must go!”

The pirates return to their seats and the captain, left with only 12 total pirates, continues to distribute the coins – “one for you,” “one for you.” Now, as the pile is almost depleted, she realizes that there are five extra coins. Immediately, the pirates again argue over the five extra coins. The captain, fearing that they will be kicked out, grabs the angriest pirate and ushers her out of the tavern with no compensation. With only 11 pirates left, she resumes distribution. As the pile nears depletion, she sees that there won’t be any extra coins. The captain breathes a sigh of relief. No arguments occur and everyone goes to bed in peace.

If there were less than 1,000 coins, how many did the pirates have to divvy up?

Click to see the answer!

Solution

There are actually infinite answers to the problem, but only one number if the answer is under 1,000. This puzzle is an example of modular arithmetic and the Chinese Remainder Theorem.

The smallest solution under 1,000 for this problem is 341 coins, and the answer is found by working backwards. To find it, we first note that with 11 pirates the coins divided evenly; hence, the number of coins is in the list:

11, 22, 33, 44, 55, 66, 77, 88, 99, 110, 121, 132, 143…

What happens if we take these numbers and divide them among 12 pirates? How many coins would be left over? Well, we want 5 coins to be left over after dividing by 12. Hence, we reduce the list above to:

77, 209, 341, 473…

These numbers divide by 11 evenly and have 5 left over when divided by 12. Now we take these remaining numbers and divide them by 13 until we find the number that gives 3 extra coins left over. Hence, 341 coins.