TOPICS
Search

100 Prisoners Problem


The 100 prisoners problem, also called the locker puzzle (Curtin and Warshauer 2006), is a probability puzzle in which 100 numbered prisoners must each find their own number among 100 closed boxes. The numbers 1 through 100 are placed uniformly at random, one per box. Each prisoner may inspect at most 50 boxes, the boxes are closed again afterward, and the prisoners may agree on a strategy beforehand but cannot communicate during the searches. All prisoners survive only if every prisoner finds his or her number. Despite the similar name, this permutation puzzle is distinct from the game-theoretic prisoner's dilemma.

If each prisoner independently chooses 50 boxes, the probability that all succeed is 2^(-100). A much better strategy views the placement as a permutation. Prisoner i first opens box i, then opens the box whose number is found inside, and continues following that permutation cycle. Every prisoner succeeds iff the permutation has no permutation cycle longer than 50.

There can be at most one permutation cycle of length greater than 50, and a random permutation has a permutation cycle of length k with probability 1/k for k>50. Therefore the success probability, whose decimal expansion is OEIS A399699, is

 1-sum_(k=51)^(100)1/k=1-H_(100)+H_(50)=0.3118278206...,

where H_n is a harmonic number. More generally, with 2n prisoners who may each open n boxes, the probability approaches 1-ln2=0.3068528194... (OEIS A244009) as n->infty (Curtin and Warshauer 2006).


See also

Harmonic Number, Permutation, Permutation Cycle, Prisoner's Dilemma, Random Permutation

Explore with Wolfram|Alpha

References

Curtin, E. and Warshauer, M. "The Locker Puzzle." Math. Intelligencer 28, 28-31, 2006. https://doi.org/10.1007/BF02986999.Gál, A. and Miltersen, P. B. "The Cell Probe Complexity of Succinct Data Structures." In Automata, Languages and Programming: 30th International Colloquium, ICALP 2003 (Ed. J. C. M. Baeten, J. K. Lenstra, J. Parrow, and G. J. Woeginger). Berlin, Germany: Springer, pp. 332-344, 2003. https://doi.org/10.1007/3-540-45061-0_28.Sloane, N. J. A. Sequences A244009 and A399699 in "The On-Line Encyclopedia of Integer Sequences."Veritasium. "The Riddle That Seems Impossible Even if You Know the Answer." Jul. 5, 2022. https://www.youtube.com/watch?v=iSNsgj1OCLA.

Cite this as:

Weisstein, Eric W. "100 Prisoners Problem." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/100PrisonersProblem.html

Subject classifications