Ponder This

July 2015

Four people stand in line with hats on their heads. On the back of each hat is a unique number (i.e., no two people have the same number) between 1 and 6. Each person can see only the numbers of the people in front of him. One by one, starting from the back of the line, they need to guess the number on their own head, but they are not allowed to use any number that was previously guessed. Since they guess out loud, all the people in line hear each other's guesses. Clearly, the last person in line (who is the first to guess) cannot guarantee being correct. Our challenge this month is to show that all the rest can.

Your challenge is to provide the strategy of the last person (the first to guess) in guessing a number between 1 and 6, as a function of the other three numbers he sees. Please provide your answer as a list of 216 digits: 1-6 for a guess, and 0 for the illegal cases (when not all the three numbers are different as they should be).

For example, here is a solution for the trivial case when the numbers are only in 1-4 range:

In this case, the last person actually knows his number as the one missing from the rest. For example, the first zero represents the illegal case when he sees "1, 1, 1"; the first nonzero number (4) corresponds to the case when he sees "1, 2, 3" in front of him; the next number (3) is used when he sees "1, 2, 4", etc. As a side note just to better explain the game, the second guesser sees two hats in front of her, and hears the guess of the person behind her and can therefore deduce her number; etc.

As we said before - we are only looking for the strategy used by the last person in line.

Update (9/7, thanks James):

The last person (first to guess) is helping the other players to win, and that they have agreed on a strategy in advance.

We will post the names of those who submit a correct, original solution! If you don't want your name posted then please include such a statement in your submission!

We invite visitors to our website to submit an elegant solution. Send your submission to the ponder@il.ibm.com.

If you have any problems you think we might enjoy, please send them in. All replies should be sent to:ponder@il.ibm.com