The U.S. National Security Agency, which works to protect the government's communications and information systems, publishes a "Puzzle Periodical" authored by NSA agents that is full of SAT-like brainteasers.

As the agency said in a press release:

"Intelligence. It's the ability to think abstractly. Challenge the unknown. Solve the impossible. NSA employees work on some of the world's most demanding and exhilarating high-tech engineering challenges. Applying complex algorithms and expressing difficult cryptographic problems in terms of mathematics is part of the work NSA employees do every day."

**RELATED: The Most Powerful Number Puzzle**

The agency then invites its staff and other readers to try their hand at a "problem written by a member of our expert workforce."

Below are the most recent puzzles for which answers are provided by the NSA. See how well you do at solving the brainteasers. The answers are at the bottom.

**1. Who Goes First?**

On a rainy summer day, brothers Dylan and Austin spend the day playing games and competing for prizes as their grandfather watches nearby. After winning two chess matches, three straight hands of poker and five rounds of ping-pong, Austin decides to challenge his brother, Dylan, to a final winner-take-all competition. Dylan clears the kitchen table and Austin grabs an old coffee can of quarters that their dad keeps on the counter.

The game seems simple as explained by Austin. The brothers take turns placing a quarter flatly on the top of the square kitchen table. Whoever is the first one to not find a space on his turn loses. The loser has to give his brother tonight's dessert. Right before the game begins, Austin arrogantly asks Dylan, "Do you want to go first or second?"

Dylan turns to his grandfather for advice. The grandfather knows that Dylan is tired of losing every game to his brother. What does he whisper to Dylan?

(Submitted by Sean A., NSA Applied Mathematician)

**RELATED: You vs. Brian: Puzzled Pint Challenge #1**

**2. Pirate Logic**

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?

**RELATED: Fill in the Blanks: A Number Puzzle**

(Submitted by Robert B., NSA Applied Mathematician)

**3. Padlock Puzzle**

Four friends, Holly, Belle, Carol, and Nick, gather for May birthdays. Holly announces that she has a game before dinner. She hid gifts for each of her friends inside three separate boxes secured with padlocks. She challenges her friends to figure out the combination without consulting each other.

She provides the following information. All the padlocks have the same combination. The padlocks use 3 digits from 0 to 9. She also tells them that the sum of the three digits is equal to nine, and every digit is equal to or greater than the previous digit. Holly tells each of her friends one of the digits in the combination. She states, "I've given the first digit to Belle, the second digit to Carol, and the third digit to Nick." The caveat is that the friends cannot share their numbers with each other or they will forfeit the gifts.

Then Holly gives her friends 30 minutes to open the padlocks while she watches and finishes dinner.

The three friends begin to think of the solution. One by one, they each try their hand at their padlock, but none of them opens the padlock. Seeing that no one has succeeded, suddenly Carol realizes she knows the answer, and successfully opens her box, revealing a new fitness tracker. Following this, Nick opens his padlock, revealing a new tablet; and Belle opens her box to find new pair of headphones.

Having watched this entire event unfold, can you determine the correct combination?

Hint: Belle knows her digit is a 1.

(Puzzle by Paul H., Software Developer, NSA)

**RELATED: Ancient Roman Puzzle Gets New Piece**

**4. Weighed Down**

Mel has four weights. He weighs them two at a time in all possible pairs and finds that his pairs of weights total 6, 8, 10, 12, 14, and 16 pounds. How much do they each weigh individually?

Note: There is not one unique answer to this problem, but there is a finite number of solutions.

(Created by Andy F., Applied Research Mathematician, NSA)

**5. Pie for a Professor**

Kurt, a math professor, has to leave for a conference. At the airport, he realizes he forgot to find a substitute for the class he was teaching today! Before shutting his computer off for the flight, he sends an email: "Can one of you cover my class today? I'll bake a pie for whomever can do it." He sends the email to Julia, Michael, and Mary Ellen, his three closest friends in the math department, and boards the plane.

As Kurt is well-known for his delicious pies, Julia, Michael, and Mary Ellen are each eager to substitute for him. Julia, as department chair, knows which class Kurt had to teach, but she doesn't know the time or building. Michael plays racquetball with Kurt so he knows what time Kurt teaches, but not the class or building. Mary Ellen helped Kurt secure a special projector for his class, so she knows what building Kurt's class is in, but not the actual class or the time.

**WATCH VIDEO: The Inheritance Puzzle**

Julia, Michael, and Mary Ellen get together to figure out which class it is, and they all agree that the first person to figure out which class it is gets to teach it (and get Kurt's pie). Unfortunately, the college's servers are down, so Julia brings a master list of all math classes taught that day. After crossing off each of their own classes, they are left with the following possibilities:

After looking the list over, Julia says, "Does anyone know which class it is?" Michael and Mary Ellen immediately respond, "Well, you don't." Julia asks, "Do you?" Michael and Mary Ellen both shake their heads. Julia then smiles and says, "I do now. I hope he bakes me a chocolate peanut butter pie."

Which class does Kurt need a substitute for?

(Created by Ben E., Applied Research Mathematician, NSA)

**6. Solve the Cypher**

(Note: The NSA brainteasers are not limited to the popular "Puzzle Periodical." A few years ago, the agency tweeted the below. Many who saw it first thought that the NSA had been hacked, or that someone did not have enough coffee before they typed the tweet, which turns out to have been written in code. See if you can figure out what it says.)

**Answers and Explanations**

**1.** Who Goes First?

Dylan should go first.

Explanation:

By doing this, Dylan can guarantee a win by playing to a deliberate strategy. On his first turn, he can place a quarter right on the center of the table. Because the table is symmetric, whenever Austin places a quarter on the table, Dylan simply "mirrors" his brother's placement around the center quarter when it is his turn. For example, if Austin places a quarter near a corner of the table, Dylan can place one on the opposite corner. This strategy ensures that even when Austin finds an open space, so can Dylan. As a result, Dylan gains victory, since Austin will run out of free space first!

**RELATED: Ancient Roman Puzzle Gets New Piece**

**2. **Pirate Logic 341 coins Explanation:

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.

**3.** Padlock Puzzle A finite number of possible solutions exist for this problem that can be listed and then crossed off based on the player's given digit. Three simple solutions exist where any player would have the combination by knowing just one single digit. These are the following: (reminder: only solutions summing to 9 and following the X<=Y<=Z property are valid)

0 0 9 (Carol and Nick would realize the answer from their given digit)0 1 8 (Nick would realize the answer if he was given 8)3 3 3 (Belle or Nick would know the combination if given this digit)

Explanation:

After 30 seconds have passed, each realizes none of the others knows the combination instantly. At this point Carol realizes the solution to the problem, since she has a digit where she could eliminate another player's list of possible quick solutions (i.e. everyone now knows Nick did not have a 9, 8, or 3 and Belle did not have a 3.)

If Carol's given digit was 1 she would know the only two possibilities are the following: (0, 1, 8) and (1, 1, 7). Because no player found the answer after 30 seconds, Nick did not have an 8, meaning Carol knew the combination was (1, 1, 7). A person exhausting all possible combinations and removing the obvious combinations will see this is the only set where Carol could know the answer. Therefore since Carol knew the answer, any observer could determine the combination as (1, 1, 7). As an FYI, Nick would likely know the answer a little faster than Belle (as he was able to eliminate more possibilities).

**4.** Weighed Down There are exactly two possible answers: Mel's weights can be 1, 5, 7, and 9 pounds, or they can be 2, 4, 6, and 10 pounds. No other combinations are possible.

Explanation Let the weights be a, b, c, and d, sorted such that a < b < c < d. We can chain inequalities to get a + b < a + c < a + d, b + c < b + d < c + d. Thus, a + b = 6, a + c = 8, b + d = 14, and c + d = 16. But we don't know if a + d = 10 and b + c = 12 or the other way around. This is how we get two solutions. If a + d = 10, we get 1, 5, 7, and 9; if b + c = 10, we get 2, 4, 6, and 10.

More on the Problem Where this problem really gets weird is that the number of solutions depends on the number of weights. For example, if Mel has three weights and knows the weight of all possible pairs, then there is only one possible solution for the individual weights. The same is true if he has five weights.

But now suppose that Mel has eight weights, and the sums of pairs are 8, 10, 12, 14, 16, 16, 18, 18, 20, 20, 22, 22, 24, 24, 24, 24, 26, 26, 28, 28, 30, 30, 32, 32, 34, 36, 38, and 40. Now what are the individual weights?

This time, there are three solutions:

**5.** Pie for a Professor Calc 2 at 10 in North Hall.

Explanation:

1) Since Julia only knows the class name, the only way she could immediately know is if it was Calc 3. Since Michael and Mary Ellen both know that Julia doesn't know, that means they know the class isn't Calc 3. Since Michael only knows the time, that means the class can't be at noon. Because Mary Ellen only knows the building, that means the building can't be West Hall. That leaves only the following possibilities:

2) Since Michael doesn't know which class it is, that means the time can't be 9 or 11. Since Mary Ellen doesn't know either, the class can't be in South Hall. That leaves only three possibilities:

3) At this point, Julia now says she knows the answer. Since there are two Calc 1 classes, it must be that Julia knows the class is Calc 2. Thus, the class is Calc 2 at 10 in North Hall.

**6.** Solve the Cypher The coded message reads:

"Want to know what it takes to work at NSA? Check back each Monday in May as we explore careers essential to protecting our nation."

Explanation Each "word" in the code contains 12 characters, suggesting that the spaces do not indicate word breaks. The letters in the code are simply replaced with others. The trick to determining which ones is to first note the letters in the code that are most commonly used: P, C and I. These likely correspond to the most common letters in English: E, T and A.

Leaders of the past, such as Julius Caesar, used similar codes. They and their supporters would have to mull over them for lengthy periods, trying to figure out the letters that should be substituted for those in the code. These type of substitution cyphers are rarely utilized today because they can be cracked in a flash by specially designed computer apps.

If you're up for more NSA brainteasers, try solving these crossword puzzles from the agency's magazine Cryptolog.

**WATCH VIDEO: Do Brain Games Really Make You Smarter?**