Home > Riddles > The executioner and the hats (3 colores)

The executioner and the hats (3 colores)

Pure logicLevel 4/5

When the number of colors increases, the problem stops being a simple game of immediate deduction and begins to require a much finer form of coordination. His interest is in how a single intervention can order what comes next.

There are 10 people in a row, numbered 1 to 10, where 10 is behind everyone. Each hat can be red, blue or green.

Person 10 speaks first and sees the hats of the 9 people in front of him; the 9 sees 8; and so on. Nobody sees their own hat or those left behind.

Taking turns, each person must say a single word out loud: “red,” “blue,” or “green.” They can't add anything more. If someone guesses the color of his hat correctly, he survives; If you fail, you die.

Before starting you can agree on a strategy. How many lives can you guarantee at least?

Hints

Show hints
  1. The first person may not be able to save himself, but he can leave useful information to others.
  2. With three colors, this information can no longer be reduced to a simple opposition between two cases.
  3. You look for a way to encode, in a single word, a global relationship between the colors you see.

Solution

Show full solution

Answer: 9 saved are guaranteed. Coding: red=0, blue=1, green=2 (module 3). Let $x_1,\dots,x_{10}$ be the real value of each hat. Person 10 (first to speak), who sees $x_1,\dots,x_9$, says:

$$ y_{10}\equiv-(x_1+\cdots+x_9)\pmod 3. $$ It may fail, but it leaves the equation fixed: $$

y_{10}+x_1+\cdots+x_9\equiv0\pmod3.
$$ Person 9 knows $y_{10}$, sees $x_1,\dots,x_8$ and solves for $x_9$:

$$ x_9\equiv-\big(y_{10}+x_1+\cdots+x_8\big)\pmod3. $$

He says it and he gets it right. Then person 8 already knows $x_9$ (heard), sees $x_1,\dots,x_7$ and solves for $x_8$; and so on until 1. All except the first are determined uniquely. Guarantee: 9 saved always; the first only has probability $1/3$ of being correct.

Related riddles

Keep practicing

If you enjoyed this one, try more pure-logic riddles, explore this theme, browse the full archive, or read the riddle-solving guide.

← Previous: The urn bet · Next: The cursed chocolate →