BrainDen.com - Brain Teasers
• 0

# A Prisoner Problem

## Question

100 prisoners are imprisoned in solitary cells. Each cell is windowless and soundproof. There's a central living room with one light bulb; the bulb is initially off. No prisoner can see the light bulb from his or her own cell. Each day, the warden picks a prisoner equally at random, and that prisoner visits the central living room; at the end of the day the prisoner is returned to his cell. While in the living room, the prisoner can toggle the bulb if he or she wishes. Also, the prisoner has the option of asserting the claim that all 100 prisoners have been to the living room. If this assertion is false (that is, some prisoners still haven't been to the living room), all 100 prisoners will be shot for their stupidity. However, if it is indeed true, all prisoners are set free and inducted into MENSA, since the world can always use more smart people. Thus, the assertion should only be made if the prisoner is 100% certain of its validity.
Before this whole procedure begins, the prisoners are allowed to get together in the courtyard to discuss a plan. What is the optimal plan they can agree on, so that eventually, someone will make a correct assertion?

## Recommended Posts

• 0

The prisoners decide that who ever is called on the first day will be the one to take the call whether all have flipped or not.

Also they decide that any prisoner (except first) going to the room will toggle the switch on IF it is off otherwise will not toggle the switch. And, any prisoner (except first) will toggle the switch ONLY once.

The first prisoner will always toggle the switch off and count the number of times he does so. When he has a count of 99 toggles to off (other than his own on the first day if the bulb wasn't off) , he announces the passage of all 100 prisoners.
##### Share on other sites

• 0

the best way i can think of:

imagine the state of the bulb, as a sequence of binary numbers.

each person notes whether the state of the bulb was different from the last time they entered.

if it is, note this as a1, if the same, note this as a 0.

then every person is assigned a different prime number and only flips the bulb on that number of times entering in the room.

once the prisoner with the largest prime has flipped it himself his prime number of times, and has seen it change state his prime number of times, he can call solved fairly confidently. i personally don't see a guaranteed solution.

Edited by phil1882
##### Share on other sites

• 0

I had a solution here, but found a flaw in it... *REMOVED*

Edited by ThunderCloud
##### Share on other sites

• 0

The prisoners decide that who ever is called on the first day will be the one to take the call whether all have flipped or not.

Also they decide that any prisoner (except first) going to the room will toggle the switch on IF it is off otherwise will not toggle the switch. And, any prisoner (except first) will toggle the switch ONLY once.

The first prisoner will always toggle the switch off and count the number of times he does so. When he has a count of 99 toggles to off (other than his own on the first day if the bulb wasn't off) , he announces the passage of all 100 prisoners.

There is a flaw in this strategy. Since the prisoners are chosen at random, the first person can visit the room all 99 times and toggle the switch off and not have 100 of the other prisoners still make it. Resulting in the death of the group. But your answer is closer to mine. Just need a little revision.

##### Share on other sites

• 0

I think DeGe's strategy is sound.

The term "toggle" may be adding confusion.

Prisoner 1 always turns the light OFF [or leaves it off]

Every other prisoner is allowed to turn the light ON only once [after they turn it on once, the leave it unchanged]. Other prisoners are not allowed to ever turn the light off.

after day 1 prisoner 1 counts the times he turns it off and after 99 he can safely assume that all have been in the room

##### Share on other sites

• 0

I think DeGe's strategy is sound.

The term "toggle" may be adding confusion.

Prisoner 1 always turns the light OFF [or leaves it off]

Every other prisoner is allowed to turn the light ON only once [after they turn it on once, the leave it unchanged]. Other prisoners are not allowed to ever turn the light off.

after day 1 prisoner 1 counts the times he turns it off and after 99 he can safely assume that all have been in the room

Thanx for making it clear.

##### Share on other sites

• 0

Thank you for clarifying

• 0

What do I do?

##### Share on other sites

• 0

What do I do?

Don't turn the light off I'm counting

• 0

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.