Learn / Library / Brainteasers
Hats with numbers on them
Each of prisoners, numbered , , , , , gets a hat showing a whole number from to , and all assignments are equally possible. Each prisoner sees the other hats but not his own. Prisoner guesses that his own number is the one that makes the total of all hat numbers leave remainder when divided by . For how many of the assignments is at least one guess correct?
Checking an answer needs JavaScript. The hint and the solution open without it.
Hint
A guess is correct exactly when the true total has a particular remainder. For which remainders of the total can someone be right?
Solution
- Prisoner is right exactly when the true total of the numbers leaves remainder on division by .
- So someone is right exactly when that remainder is one of , , , , , that is, when it is not .
- The remainders of the total are equally spread over the assignments, with assignments for each of the remainders.
- The number of assignments with at least one correct guess is therefore .
Answer: