Qm
BrainteasersJane Street

Infinitely many prisoners, only finitely many die

An infinite line of prisoners stands numbered 1, 2, 3, ... Each wears a red or blue hat. Prisoner n can see the hats of every prisoner with a larger number (all of them, infinitely many) but not their own or anyone behind. At a signal, everyone guesses their own hat colour at the same moment. There is no communication of any kind once the hats are on.

The prisoners may agree on a strategy beforehand, and they are allowed to assume the axiom of choice.

Show that there is a strategy under which only finitely many prisoners guess wrongly, no matter how the hats are assigned.

This is genuinely surprising: any single prisoner, in isolation, is right only half the time.

Show a hint

Call two infinite hat sequences "cousins" if they differ in only finitely many positions. Every prisoner can tell which family of cousins the real sequence belongs to. Agree in advance on one representative sequence for every family.

Your answer

Solving needs a free account

Answers, streaks and solutions unlock when you are signed in. Reading the question and the hint stays free.

Discussion

Sign in to join the discussion · reading is open to everyone

💡 Discussion rules

  1. No full solutions here. Hints and approaches only.
  2. Complexity, edge cases and intuition are the point.
  3. Interview experiences are welcome. Respect your NDAs.

Loading discussion…

Learn the concepts

The theory behind this question.

Related questions

Ten prisoners and hats of ten colors100 prisoners guessing hat colors in a lineFour prisoners, four hats and a wallEveryone shouts the number of red hats, one must be rightEveryone guesses their hat at once
All questions →