The 100 prisoner puzzle

The puzzle:

  • There are 100 prisoners, 1 to 100
  • The prisoners are to find their number, which are randomly hidden in 100 boxes.
  • If everyone find their number within 50 attempts, they all win.
  • If anyone takes more than 50 attemps to find their number everyone loses.

The strategy:

  • If they pick at random, the group has 8 * 10^-34 chance of success. Fortunately there is a solution, and it goes as thus:
  • Each person opens the first box corresponding to their own number
  • Then they open the next box corresponding to the number inside the previous box
  • Then they follow the chain until they find their own number
  • This strategy improves the odds of sucess to ~30%
  • How does it work? 🤷‍♂️ magic probably.

A more detailed explanation is found Here

    Output
    runs per interval: 1