Prisoners and hats
There are 5 prisoners in a cell. The deal is as follows: each prisoner will
be given either a blue hat or a green hat. No prisoner knows the color of his
own hat, but he can see the hat colors of all the other prisoners. The
prisoners are lined up in a row (in a random order), and each prisoner in turn
must say either “blue hat” or “green hat”; if he is correct, he is freed,
otherwise, he is sent back to prison for life. Any other statement results in
everybody being sent back to prison.
What is the minimum number of prisoners they can guarantee will go free, and
what strategy will achieve this?