Probability · Viral
The 100 Prisoners Riddle
Random guessing gives the prisoners less than $0.0000\ldots1\%$ chance of survival. One clever strategy gives them 31%. Here is the strategy, the loop trick that powers it, and the proof.
Quick answer
The optimal strategy is the loop strategy: each prisoner first opens the box labeled with their own number, then opens the box labeled with whatever number they find inside, and continues following the chain. Survival probability: about 31.18%. Compare to the random strategy, where every prisoner independently flips coins: the chance all 100 succeed is $(1/2)^{100} \approx 7.9 \times 10^{-31}$. The loop strategy turns near-certain death into a 1-in-3 chance.
Open this in math.im for the full interactive version →
Canonical URL: https://math.im/blog/100-prisoners-hat-riddle.html