Problem 47668. A KING AND 100 PRISONERS

There are 100 prisoners in 100 different cells.
The cells were enclosed, and the prisoners could not tell the time in any way in their cells, nor could they communicate with each other.Pick a random person every day to go out to a particular place.
The place where was a light inside, which the prisoners could turn on or off at their own choice, and no one but the prisoners could switch the light.The lamp never breaks.
The king thought of a game, if someone could prove to the king that every prisoner had been picked in 20 years, the king would set them free.
Now give the prisoners a way to talk things over, and then play games.
After some discussion, Prisoner A came up with an idea.
He told others some rules. If others follow the rules, then he can prove it
. The rules are as follows:
1.Prisoner A will turn off the light when he found it on.If it is not on, Prisoner A does not operate.
2.If other prisoners find out for the first time that the light if off, turn it on.
After some discussion, the prisoners are sure that will work, but the question is, how long would it take to get out? Can they prove the king's proof question in 20 years?
Simulate this situation and estimate the time required.

Solution Stats

90.48% Correct | 9.52% Incorrect
Last Solution submitted on Nov 14, 2023

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers17

Suggested Problems

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!