You are one of **20 prisoners** on death row with the execution date set for tomorrow.

Your king is a ruthless man who likes to toy with his people’s miseries. He comes to your cell today and tells you:

“I’m gonna give you prisoners a chance to go free tomorrow. You will all stand in a row before the executioner and we will put a hat on your head, either a red or a black one. Of course you will not be able to see the color of your own hat; you will only be able to see the prisoners in front of you with their hats on; you will not be allowed to look back or communicate together in **any way** (talking, touching, signalling, etc).

(The prisoner in the back will be able to see the 19 prisoners in front of him The one in front of him will be able to see 18, you get the idea).

Starting with the last person in the row, the one who can see everybody in front of him, he will be asked a simple question: **WHAT IS THE COLOR OF YOUR HAT?**

He will be only allowed to answer “**BLACK**” or “**RED.” **

If he says anything else you will ALL be executed immediately.

If he guesses the right color of the hat on his head he is set free, otherwise he is put to death. And we move on to the prisoner in front of him and ask him the same question and so on.

So RiddleDuders, what is the strategy they devise to free as many prisoners as possible?

Warning: Use of undefined constant bfa_comments - assumed 'bfa_comments' (this will throw an Error in a future version of PHP) in/home/customer/www/riddledude.com/public_html/wp-content/themes/atahualpa/comments.phpon line132I love this one :)

The only solution I can arrive at is it needs to be assumed by the 20th prisoner that there is an equal number of red and black hats. He would count the hats in front of him and assume the color with nine would be the color on his head. From there, the 19th guy would do likewise, taking into account the color announce by the guy behind him. Since the number of red and black hats is not mentioned above, I have to figure I’m barking up a tree in the wrong forest.

You’re on the right track, Paul, but . . .

Keep guessing!

(you’re very close)

Formula: The last person looks and counts how many black hats there are. If there are an even number, he/she says red. If it’s odd he/she says black. This is the signal for the rest of the prisoners. Last man only has 50/50 chance.

Senario 1: 19 black and last person is red.

Last person sees 19 black hats so he says black. He is red so he dies. The 2nd to last guy looks and sees 18 black hats. He knows that there is an ood number of black hats in the line. Even + 1 is odd so he knows he’s black. Repeat process for all people remembering the colour of hat of the person behind him and that even +\- 1 is odd.

Omg thought about this so hard……… My dad helped me though

You’re correct, Eddy G.

First guy is a coin toss – let’s wish him good luck.

His job is to establish the parity of black hats visible to him.

He says “Black” if he sees an odd number of black hats; “Red” otherwise.

By paying attention to what has been said, each prisoner will know his hat’s color.

Example:

Second to speak hears “Black” and sees an even number of black hats.

He knows his hat is black [odd changed to even – must be his is black] and says “black”.

Third guy has heard “black” and “black” and sees an even number of black hats.

He knows his hat is red [even stayed even – his hat can’t be black] and says “red”.

And so on, to the front of the line.

General algorithm:

The first time you hear “black”, say to yourself “odd”.

Each time your hear “black” after that, change the parity: “even”, “odd”, … etc.

When it’s your turn, if the black hats you see match the running parity, you’re Red; Black otherwise.

Call out your color.

You’re today’s winner.