Monday, February 05, 2007

What happens if you go to the pub with mathematicians

In the pub tonight we were discussing hat problems. Not the sort that involve whether a plaid hat goes with a blue coat or not, but the mathematical or logical kind of one.

Here's an example (answer tomorrow):

There are 20 prisoners (it's always prisoners in these things). Each of them will be given a hat to wear which will be coloured with one of 20 colours. Some colours may be repeated. The prisoners will be made to stand in a line in a courtyard so that they can only see the prisoners in front of them. They cannot see their own hat, nor can they see the hats of the people behind them.

Once in position (they are all blindfolded until they are there) the prisoner at the back has to state a colour that he believes his hat is. If he is right he lives, if not he dies. Then the prisoner in front does the same. And so on until the guy at the front.

They are allowed to consult beforehand to determine a strategy to follow that will ensure as many of them as possible survive. Assuming they then follow this strategy, what is the maximum number of prisoners they can guarantee will survive?

And more importantly, have I stated this somewhat convoluted problem properly so that a) it has a solution and b) it has the solution I expect?

1 comment:

Tsuki said...

I'm noting a lack of answer... Now I know (having had clever people work it out in my presence) but it would be annoying if I didn't.