I found the following problem on instagram:
Seven prisoners are given the chance to be set free tomorrow. An executioner will put a hat on each prisoner's head. Each hat can be one of the seven colors of the rainbow and the hat colors are assigned completely at the executioner's discretion. Every prisoner can see the hat colors of the other six prisoners, but not his own. They cannot communicate with others in any form, or else they are immediately executed. Then each prisoner writes down his guess of his own hat color. If at least one prisoner correctly guesses the color of his hat, they all will be set free immediately; otherwise they will be executed. They are given the night to come up with a strategy. Is there a strategy that they can guarantee that they will be set free?
Now, generalizing this for n people and n hats, the usual solution involves coding each color with a number in Z/nZ and for the ith person to calculate what it's hat color should be if the sum of all colors was equal to i. More information here: (Rainbow Hats Puzzle).
I, however, didn't really like this solution because each person is using the information of its own personhood (it's i value) as well as what they can see in the circle. In other words, the "strategy" is a function of each color the person is seeing as well as of which person it is: f(c1,...,c_(n-1) , i).
I was wondering if, by not allowing the last variable it is still possible to solve it (meaning the strategy must not differentiate each individual but depend only on the colors that are seen). I think it isn't and managed to prove by hand that n = 2 and n = 3 are impossible.
My first try to attack this problem so far has been to consider some special cases to gain information about f and try to achieve a contradiction. For example, it's easy to see that f(c,c,...,c) = c ( if all the colors a person sees are equal, the strategy must involve them saying that color ). My second try was a counting argument but i don't really know combinatorics so my ideas were limited.
Anyone has any idea on how to solve this?
Here is a probabilistic argument.
Suppose the executioner decides to allocate the hat colours uniformly at random with replacement, i.e. with $n^n$ equally likely possible allocations.
Then the probability an individual prisoner's guess as to their own colour has probability $\frac1n$ of being correct, and the expected number of correct guesses is $1$.
If there is a non-zero probability that two or more guesses are correct then there must also be a non-zero probability that no guesses are correct, which prevents the guarantee.
So no prisoner can adopt a strategy which has any randomness in response to the colours seen.
Nor can two prisoners adopt identical strategies, since there is a non-zero probability that they both see the same pattern of colours on others.
So any overall strategy providing the guarantee must require distinct individual response strategies for different prisoners, so each response depends on the individual answering. The linked answer to this question is an example of such distinct strategies and it works, though there may be other possibilities that also work.