Send to a Friend

LostInParadise's avatar

Can you figure out my variation on a colored hat problem?

Asked by LostInParadise (31921points) February 18th, 2012

There are a number of logic problems involving people wearing black or white hats, with the object being for the person to guess the color of his own hat. I came up with a variation on one of these problems using three hat colors instead of two.

I will first present the original problem and its solution. My variation will be to simply change the number of hat colors from two to three.

A group of prisoners is told that they will be given a test that will allow them to go free if they pass it. The prisoners will be seated one in front of the other, so that each can only see the people in front of him. Each prisoner will have a black or white hat placed on his head. Starting with the prisoner in the back and moving forward, each prisoner will be asked the color of his hat. If he guesses correctly, he will be allowed to go free.

Before the test, the prisoners are permitted to meet together to work out a strategy. It is agreed that the first person to be questioned has no way of knowing his hat color, so his answer will be a code that can be used by the other prisoners to guess his hat color. You can stop reading at this point if you want to solve this problem on your own.

The solution is to have the prisoner in the back give one color, say black, if the number of black hats he sees is even, and the other color if the number he sees is odd. The next prisoner will be able to tell his own hat color by checking to see if the oddness/evenness has changed. If it has changed, his hat is black, otherwise white. Each other prisoner updates the parity of hat color based on previous answers and can then figure out his own hat color.

My variation on this is the same as the first problem, except that there are three hat colors: red, yellow and blue. What strategy can they work out so that the first prisoner questioned uses a code that will allow the others to guess his hat color? My solution makes use of modular arithmetic, sometimes called clock arithmetic.

Using Fluther

or

Using Email

Separate multiple emails with commas.
We’ll only use these emails for this message.