A logic problem

DeletedUser

Not really very D&D but I came across this problem in a book - I could not figure out the answer myself but when I cheated and read it I was amazed. It is not a trick question, but a surprising and logical solution.

There are 50 prisoners. Their evil captor announces that the next day they will all be buried up to their necks in a line and facing the same way down the line, and either a white or black hat will be placed on each one's head. No one can see his own hat, but the first prisoner can see the hats of the 49 in front of him, the next can see the 48 if front of him, and so on down to the last prisoner, who obviously sees none of the others.
The first prisoner will be asked to guess the colour of his own hat, and if he is right he will be released - if not, he will be shot. He can only say "white" or "black" and he is within earshot of his nearest neighbours. Clearly, each prisoner has a 50:50 chance of freedom if he guesses randomly.
One of the prisoners is a mathematician however and he devises a scheme whereby, if he goes first, he can save all the other prisoners, although possibly not himself. Of course he can save the second prisoner by announcing the colour hat that that prisoner is wearing, allowing him to 'guess' right, but that will not help the next one. What was the mathematician's solution?
 

DeletedUser

Will there be equal no[25/25] of hats?If not I know how they can count how many black or
white hat there is but not the color of their own hat. :(
 

Slygoxx

Well-Known Member
The first prisoner will count the amount of black and white hats in front of him. If he counts an odd number of black hats in front of him, he says white. If he counts an even number of black hats in front of him, he'll say black. Of course, this will give him a 50% chance to guess his own hat correctly.

The next prisoner will hear what the first prisoner says, let's assume the first one says white. He will then count the amount of black and white hats in front of him, if the number of black hats is even, he will say black, if the number is odd, he'll say white.

Etc.
 
Last edited:

Slygoxx

Well-Known Member
Didn't look it up, I just read roughly same question some time ago :p I did come up with the solution myself back then though.
 

DeletedUser

How does that work? Some intrinsic math property I'm not aware of?
 

Slygoxx

Well-Known Member
Nope.

Let's assume the first prisoner counts an odd number of black hats in front of him. The second prisoner counts an even number of black hats in front of him. To make the number odd, like the first prisoner counted, he'd have to have a black hat.
 

DeletedUser

Interesting. I wonder what would happen if one of the prisoners counted wrong....I'm guessing the next prisoner would guess what the previous one did.
 
Top