Photo

Our puzzle this week was suggested by Andrew Luck, the record-setting quarterback of the Indianapolis Colts. Mr. Luck was the N.F.L.’s number one draft pick in 2012 and led a remarkable turnaround of his team during his first year, taking it from 2-14 in 2011 to 11-5 in 2012. This year the Colts continue to thrive under Luck’s leadership, finishing the regular season atop their division with an 11-5 record.

Mr. Luck also happens to enjoy the puzzles we explore each week on Numberplay. I asked him if he had a suggestion for a puzzle, and how he would go about solving it: if he would draw it out, or use equations or do something else. “The puzzle with the monster on the island is a good one. The monster who says he’ll eat everyone but gives them a chance to survive. As for solving it — I wouldn’t really draw out anything or use equations. I would just talk it through like I’m talking to you right now. I don’t write down very much when I’m solving problems. Even back when I was a student. I think about problems a lot more clearly if I can discuss them.”

Thank you, Mr. Luck. We may have done a similar problem years ago but there’s no harm in revisiting a classic. Here’s —

The Monster Problem

Ten people find themselves stuck on a remote island. One day a terrible monster appears. The monster says that he intends to eat each one of the 10 people but will give them the following chance to survive: In the morning, the monster will line up all 10 people in a line so that the first person sees the remaining nine, the next person sees the remaining eight, and so on. The monster will then place either a black or white hat on each person’s head. Each person in line can see all hats in front but not his or her own hat or the hats behind them. The monster will then ask each person (starting with the first one) to guess the color of his or her own hat. The person can say only one word — either “white” or “black.” If the person is wrong the monster will devour him or her on the spot. All remaining people will hear both the guess and the result of the guess. The monster will then move on to the next person in line and repeat the process until each of the 10 people is questioned. The 10 people have all night to plan their strategy. The question is — what should they do?

As always — use Gary Hewitt’s Enhancer for an optimal Numberplay experience. And send your favorite puzzle to gary.antonick@NYTimes.com.

Solution

Jan from Ann Arbor said it well:

The first person says black if the number of black hats in front of him is odd and says white if the number of black hats is even. This works no matter the number of people in line.

And each person in line would follow the same strategy. It’s pretty easy to see that this works by imagining yourself somewhere in line: if you see an odd number of hats ahead of you and the person behind you says “black,” which means she also sees an odd number of black hats (all the ones you see plus yours), then your hat can’t be black.

This approach would guarantee survival for everyone but the first person, who would have a 50% chance of being devoured.

Coffeedrinker had several alternate strategies, including a couple options that turned the tables on the monster:

Since there does not seem to be rules about touching, then the person behind touches the right shoulder if the next person if the hat is black and touches the left shoulder if the hat is white. Then the only person at risk is the first person and he/she has a 50% chance of getting it correct. Also since Monsters seem to be creatures of structure and habit (lining up all 10 in a neat row) the first person could assume the structured order of the monster’s brain would mean that the first person could look for a pattern in the hats and increase his/her odds of picking the correct color. Or they could spend all night building a trap for the monster and his hats, then when the monster comes the next day, they capture and devour the monster. Or they could refuse to line up. Make the monster work for his food by chasing them all around the island.

And polymath followed with perhaps the most realistic solution:

“The 10 people have all night to plan their strategy. The question is — what should they do?” They should just socialize, or play Scrabble, or tennis, since there are no such thing as monsters that eat people. The monster may have *said* he intends to eat the people, but that was just empty blather.

Gary H summarized what I think was the most astonishing bit about this puzzle: it was actually about n different-colored hats, and not just 2:

I like that the puzzle seems to be about parity (black/white) and has an odd/even solution, but really this parity is a special case of modular arithmetic. It’s not necessarily directly obvious that increasing the number of colors of hats reduces the survival odds for only the first person under this strategy, and everyone else survives.

Touching on an issue raised by Maura T. Fan, Numberplay conversations often settle on a general solution — something that works for any number of the various components involved. In solving this problem, which involved 2 hat colors and 10 people, many readers ignored the exact number 10, converting it to “a bunch,” but didn’t do the same thing with hat colors. Speaking for myself — I had not even conceived more than 2 colors for hats. How did I miss that?

Joe, Mark and Hans were among those who saw more than 2 hat colors. How? I sent Mark an email and received this reply:

Like you, when I first thought about the problem I paid little attention to the number of people in line, 10, and only focused on two colors for the hats, black and white. As I read through the comments though, especially about three colors, I realized that if we forget about hat on guy number one (poor soul), each person in line knows all of the colors except her own. Thus she needs only one piece of information to be provided by the first person to find her color, and using a larger number of colors shouldn’t really make the problem more complicated. If there are n colors, it makes sense to think in terms of residues modulo n. From there it’s a shorter leap to come up with the idea of using the sum. Hans deserves credit for figuring it all out without looking at the comments thread.

Really cool. Mark picked up an earlier suggestion by Joe and carried it forward beautifully, including a remarkable variation that would enable the first person, with a single utterance, to let everyone else know what color hat they were wearing. But Hans — how did he manage to avoid getting stuck on just 2 colors for the hats? I sent him an email and received this reply:

The upper bound of number of distinguishable cases can be argued from information theory point of view. The maximal number of cases covered with the information each one receives is c^(p-1) using my notation. This argument only give a hint and an upper bound. The construction of the specific operation has to be invented. It is more complicated.

OK. I don’t know exactly what that means, but it’s pretty clear Hans perceived this problem differently from the rest of us, perhaps by using a model that helped him avoid seeing black and white as parity.

Joe Fendel had done the the same thing, seeing, in a way, a two-sided die while many of the rest of us saw a coin. It was a simple but brilliant conception. How did he see this? I followed up by email. Mr. Fendel’s response: “‘Parity’ is just a special term for equivalency modulo 2, so any ‘parity’ puzzle is worth considering whether it extends to modulo N. Some do, and some don’t.” A beautiful way to put it. But how did Mr. Fendel think of this in the first place? I followed up again and he responded, “Not really sure, but I did some lengthy exploration of parity puzzles in the context of a math seminar I took in my freshman year [at Harvard] from Persi Diaconis.” Ah. Persi Diaconis is a legendary mathematician and expert statistician, so this connection may have had some impact.

As a final note: Andrew Luck led one of the greatest comebacks in NFL history this week by rallying the Colts from a 28-point third-quarter deficit to pull out a 45-44 win over the Kansas City Chiefs in a first-round playoff game. Congratulations to Mr. Luck and the Colts.

Thank you, Andrew Luck, and thanks as well to everyone who participated this week: Bill, Neal, Rich in Atlanta, Long Memory, Willie, Jan, Leapfinger, Joe Fendel, RS, Ravi, lurbanci, Maura T. Fan, coffeedrinker, SuperMan, Mark, Hans, polymath, Jim and Gary.