Member-only story

Most Bizarre Riddle Ever?

John Clark Craig
6 min readJul 1, 2022

The 100-Prisoners riddle is ridiculously weird and hard to believe, but with a short Python program we can verify, or dispute, what the experts claim.

Photo by Alexander Krivitskiy on Unsplash

Imagine a prison with 100 prisoners, each with a number from 1 to 100 printed on their back. A room is set up with 100 boxes labeled 1 to 100. Each box has one of the numbers from 1 to 100 randomly placed inside.

Each prisoner is allowed to enter the room one at a time, and they can open up to 50 of the boxes. As soon as they find their own number, they put everything back exactly the same as when they entered the room, and they get to move on through to a waiting room. They are not allowed to communicate with the remaining prisoners, each waiting to take their turn in the room.

Here’s the Catch

If all 100 prisoners successfully find their own number in one of the boxes, they all get to leave the prison and go home. But as soon as any one prisoner fails to find their own number in one of the 50 boxes they open, all prisoners immediately return to their cells.

What Are the Odds?

It’s obvious that the first prisoner has a 50–50 chance of finding his or her own number in one of the 50 boxes. For both the first and second prisoners to succeed the odds are 25%, or 1 in 4. So far so good. Or bad, depending…

--

--

John Clark Craig
John Clark Craig

Written by John Clark Craig

Author, inventor, entrepreneur — passionate about alternate energy, technology, UFOs, and how Python programming can help you hack your life.

Responses (2)