Math (Logic) Riddle
Math (Logic) Riddle A Warden meets with 20 prisoners and tells them the following: 1) Each prisoner will be placed into a room numbered 1-20. Each will be alone in the room, which will be soundproof, lightproof, etc. In other words, they will NOT be able to communicate with each other. 2) They will be allowed one planning session before they are taken to their rooms. 3) There is a special room, room 0, where there is a light bulb in the ON position. It can only be turned ON or OFF. 4) One at a time, at random, a prisoner will be brought into room 0 and can choose to turn the light bulb ON or OFF or leave it as is. NOTHING ELSE IS ALLOWED. 5) There is no limit to the amount of times a prisoner can be brought to the room. 6) At some time, there exists the situation where every prisoner has visited room 0 at least 1 time. 7) At any time, any prisoner may declare that all 20 of them have been in room 0. If right, the prisoners go free. If wrong, they are all executed. What initial strategy is 100% guaranteed to let them go free?
How's it coming...?
Hint: There needs to be a guy who counts
The guy who counts is the same guy who turns the lightbulb off whenever he comes in the room. So, the other prisoners turn on the lightbulb, and only he can turn it off.
Can you find the solution, now?
SPOILER SPOILER SPOILER Once the counter has counted 20 lightbulbs, he will be certain that everyone has visited the room. This can only be true if each prisoner turns on a lightbulb ___ time(s).
I know the solution. It is just a fun riddle
Only turn on the bulb if it is your first time in the room.
I remember encountering this an year ago. (Though I did not remember the solution.) :)
Solution: During the planning session they elect one prisoner as the counter. The counter is only allowed to turn the light off and counts how many times he turns it off until 20. The other prisoners are only allowed to turn the light on once, and must turn it on once. If they get to the room and the light it off they turn it on. If they have already turned the light on, they do nothing. If the light is on and they haven't turned it on yet, they simply wait there turn.
Good job though !!! :)
Join our real-time social learning platform and learn together with your friends!