10 prisoners are held captive by a cruel warden. One day he gathers them in the prison hall and tells them about a new game he wants to play:
"Tomorrow, I will assign each one of you a random single digit number known only to me, for you knuckleheads: that's zero to nine! Each one of you will get a number independently of others - for all I care everyone of you is a zero. I will then put you in isolated cells, and through the food slot give each of you a list. This list will contain all of the other prisoners numbers in a random order. One by one, I will then remove every prisoner from his dirty cell and ask him what number he thinks he was assigned. I will then put him back in isolation. Don't think for a second you'll hear his guess, the isolation cells are sound proof. If at least one of you miserable lowlifes guesses his own number correctly, you are all free to leave. But if not, you will be denied of food until you die horribly. Don't think for a second I will tolerate any form of communication between yourselves after put in isolation. I will personally execute anyone who dares break this rule. You may discuss your strategy until tomorrow. Goodbye for now"
He then shuts the door of the hall close and leaves them be.
One of the prisoners then shouts out loud:
"I have a strategy that will get us all out for sure!"
Assuming his statement was true, can you explain what might this strategy be?
Answer
The strategy is:
The $i$-th prisoner ($i$ numbered from $0$ to $9$) sums the numbers on the list, and picks a number $X$ as his guess such that $(sum + X)\equiv i\pmod{10}$.
This $i$ is predetermined, each prisoners must agree who has $i = 0$, $i = 1$, and so on.
Why it works:
We are actually trying to find the sum of all actual numbers modulo $10$.
There are $10$ possibilities: from $0$ to $9$, and the $i$-th prisoner tries the $i$.Note that the possible value of $X$ is only one for each prisoner.
For example:
Ordered from $0$-th to $9$-th, prisoners are assigned on these rooms: $1, 4, 6, 6, 1, 7, 3, 8, 2, 6$.
Sum of these rooms is $44$.The $0$-th prisoner got $4, 6, 6, 1, 7, 3, 8, 2, 6$ whose sum is $43$.
He will pick $X = 7$ as $43 + 7 \equiv 0\pmod{10}$.The $1$-th prisoner got $1, 6, 6, 1, 7, 3, 8, 2, 6$ whose sum is $40$.
He will pick $X = 1$ as $40 + 1 \equiv 1\pmod{10}$.The $2$-th prisoner got $1, 4, 6, 1, 7, 3, 8, 2, 6$ whose sum is $38$.
He will pick $X = 4$ as $38 + 4 \equiv 2\pmod{10}$.The $3$-th prisoner got $1, 4, 6, 1, 7, 3, 8, 2, 6$ whose sum is $38$.
He will pick $X = 5$ as $38 + 5 \equiv 3\pmod{10}$.The $4$-th prisoner got $1, 4, 6, 6, 7, 3, 8, 2, 6$ whose sum is $43$.
He will pick $X = 1$ as $43 + 1 \equiv 4\pmod{10}$.The $5$-th prisoner got $1, 4, 6, 6, 1, 3, 8, 2, 6$ whose sum is $37$.
He will pick $X = 8$ as $37 + 8 \equiv 5\pmod{10}$....
At the end, the prisoner who answer correctly is only the $i$-th prisoner where $i$ is the sum of actual numbers modulo $10$, which is $44\equiv4\pmod {10}$.
As you can see, the $4$-th prisoner got his number right (room $1$).
No comments:
Post a Comment