🔴 Riddle #61 of 240
Seven prisoners will each be given a hat of one of seven colours (colours may repeat). Each prisoner sees everyone else's hat but not their own, and all seven must guess their own colour simultaneously, with no communication once the hats are on. They can plan beforehand. How can they guarantee that at least one of them guesses correctly?
Think about it first. When you're ready:
Sum of hats modulo 7
Prisoner i assumes the total of all seven hats is i (mod 7) and guesses his own colour from that; exactly one assumption is correct, so one guess is always right.