### Prisoners with hats

Monday, September 19th, 201130 prisoners will line up facing the same way and with a black or white hat on their head. They are not told how many hats there are of each colour. Each prisoner can only see the hats of those in front of him, but not his own or that hats behind him. A guard will ask each in turn, starting with the prisoner at the back of the line, the one who can see all the hats except his own, which colour their hat has. The prisoners can only answer ‘black’ or ‘white’. If they are right they are liberated, if not they are executed. Every prisoner can hear the answers to the other prisoners. The guard does not say who answered correctly until they all have answered.

Before the test starts the prisoners, who know the procedure of the test outlined above, are given time to discuss the best strategy they should follow to make sure that the maximum number of prisoners survice.

What is their best strategy? How many will survive?

The Royal Spanish Mathematics Society is 100 years old this year. The newspaper El País celebrates this with a math problem every week. The problem above is, in essence, one of them. Here is a video presenting the problem (in Spanish).