BrainDen.com - Brain Teasers
• 0

# 3 Hats...

## Question

Sorry if this has been posted before, a friend texted me this saying he needed the solution ASAP, I can proudly say I replied in a very timely manner...

Again it's that psycho warden with the obsession with hats and logic coming up with a new challenge, 3 prisoners, each gets a hat, the hats can be colored red green or yellow (no one knows how many hats in total there are of each color) each prisoner can see the hats of the other two but not his...

Each must write down the color of their hat on a piece of paper, if at least one of them is correct they all go free, what should they do?

(btw there's the usual rule if they talk or anything they all get executed, they may agree on a strategy before but that's it)

## Recommended Posts

• 0

1 Red
2 Green
3 Yellow
Red
Green

Method

If Player 1 sees two matching hats he selects that colour otherwise he selects the missing colour

Player 2 does the same except when he selects he picks the next colour down the list

Player 3 does the same except when he selects he picks the next next colour down the list

Example

so if there are 2 red hats followed by a green one player 1 sees red and green so he picks Yellow (which is incorrect)

Player 2 however also sees a red and green hats so he picks yellow + 1 = red (which is correct)

Player 3 would see two red hats so would pick red + 2 = yellow (incorrect)

Edited by phaze
##### Share on other sites

• 0

Okay, the problem with this is that there isn't a set number of colors. If they can be any number of hats and they're all red, green and yellow, even trying to pick the one that you don't see won't mean anything. Just because you see red and yellow doesn't mean yours is green.

However, being able to plan out a strategy beforehand changes things, especially since only one of them has to get it right. One of them just has to go first and choose a color that he sees on the others, and the other two copy what he puts.
##### Share on other sites

• 0

Each of them is going to have a different color,so all the three have to write only one color,let us say red.

that means,at least one of them wiil be correct.
##### Share on other sites

• 0

That can't be right because there could be two yellow and one green, with no red. Then if they all pick red, no one gets it right and they all die.

##### Share on other sites

• 0

Sorry if this has been posted before, a friend texted me this saying he needed the solution ASAP, I can proudly say I replied in a very timely manner...

Again it's that psycho warden with the obsession with hats and logic coming up with a new challenge, 3 prisoners, each gets a hat, the hats can be colored red green or yellow (no one knows how many hats in total there are of each color) each prisoner can see the hats of the other two but not his...

Each must write down the color of their hat on a piece of paper, if at least one of them is correct they all go free, what should they do?

(btw there's the usual rule if they talk or anything they all get executed, they may agree on a strategy before but that's it)

Here's how I believe the prisoners should approach this

Let Red = 0, Green = 1, and Yellow = 2. Let the prisoners be labelled by numbers 1, 2, and 3, respectively, and let the prisoners' respective hats be denoted as h1, h2, and h3.

Prisoner i should assume that the sum of the all hats modulo 3 is equal to i. That is, prisoner 1 should assume that

(h1 + h2 + h3 ) modulo 3 = 1

Prisoner 2 would then assume

(h1 + h2 + h3 ) modulo 3 = 2

And prisoner 3 assumes

(h1 + h2 + h3 ) modulo 3 = 3 = 0.

After the game starts, each prisoner should look at the remaining 2 hats and compute his own hat number (or color) from the assumptions above. One of the assumptions would have to be right, so we are guaranteed to have 1 correct guess (and 2 incorrect guesses) every time using this strategy.

##### Share on other sites

• 0

Kudos to Anza Power and Bushindo! It is surprising just how much can be performed by a team in collusion, but incommunicado!

##### Share on other sites

• 0

phaze and bushindo are both correct, my solution was the same as bushindo's one, phaze's solution is a little harder to understand why it works but it's exactly the same as the arithmetic one just worded differently...

##### Share on other sites

• 0

Indeed, The solution discovered by you and Bushindo is immediately applicable to N colors and prisoners for any N, while Phaze's solution requires some additional conditions.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.