There are people standing in a circle. Each person is given one hat to wear. A hat is either colored , or . A person cannot see his own hat color, but he can see the colors of the hats of all other people standing in the circle.
At the same time, each person is asked to guess the color of their own hat and all of them have to answer at the same time . They only win if all people guess their own hat color correctly.
The people are allowed to devise a strategy before they are given their hats. They agree on a strategy that maximizes their chance of winning . If can be written as with coprime positive integers and , enter your answer as .
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Let a be the number of b l u e hats a certain person can see and b , c be the number of r e d , b l a c k hats accordingly.
One strategy that maximizes the chance of winning is the following:
If a ≡ b ≡ c ( m o d 3 ) , guess b l u e .
If a − 1 ≡ b + 1 ≡ c ( m o d 3 ) , guess r e d .
If a − 1 ≡ b ≡ c + 1 ( m o d 3 ) , guess b l a c k .
First, note that every person with the same hat color gives the same answer , as they see the same amount of b l u e , r e d and b l a c k hats.
Furthermore, 2 people who wear different hat colors see the same amount of hats with the third color (the color which neither of them wears) and a different amount of hats of the other 2 colors ( ± 1 hat and therefore different values ( m o d 3 ) ). Thus, any 2 people wearing different colors guess different colors , because any 2 different combinations of a , b and c within the same "guessing group" differ in a , b and c .
Lastly, whenever the group of people wearing b l u e hats guesses b l u e , everyone guesses their own hat color correctly. A person wearing b l u e only guesses b l u e if he sees a ≡ b ≡ c ( m o d 3 ) . A person who wears r e d sees one b l u e hat more and one r e d hat less than a person wearing b l u e and therefore sees a − 1 ≡ b + 1 ≡ c ( m o d 3 ) and guesses r e d . This means that a person wearing b l a c k guesses b l a c k , because it is the only color that is left. (Note that this strategy does not "favor" any color. You can make the same argument with r e d or b l a c k hats instead of b l u e .)
Since the probability that someone guesses their own hat color correctly has to be 3 1 , because a person cannot gain any information about his own hat color , and the only two possible outcomes are that everyone guesses their own hat color correctly or incorrectly at the same time, the chance of winning is 3 1 . This also guarantees that there can not be a better strategy.
This yields a solution of 1 + 3 = 4 .