• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Try to solve this puzzle! (heard on Cartalk today)...23 prisoners.

Entity

Lifer
I heard this today on Cartalk and had to look up the answer. It's a simpler answer than I thought it would be, but was still out of my grasp. 🙂

If you know the answer from past experience or from googling for it, please don't post it. I'll post the answer eventually if need be.
This puzzle has been making the rounds of Hungarian mathematicians'
parties.

The warden meets with the 23 prisoners when they arrive. He tells
them:

You may meet together today and plan a strategy, but after today you
will be in isolated cells and have no communication with one another.

There is in this prison a "switch room" which contains two light
switches, labelled "A" and "B", each of which can be in the "on" or
"off" position. I am not telling you their present positions. The
switches are not connected to any appliance. After today, from time to
time, whenever I feel so inclined, I will select one prisoner at
random and escort him to the "switch room", and this prisoner will
select one of the two switches and reverse its position (e.g. if it
was "on", he will turn it "off"); the prisoner will then be led back
to his cell. Nobody else will ever enter the "switch room".

Each prisoner will visit the switch room arbitrarily often. That is,
for any N it is true that eventually each of you will visit the
switch room at least N times.)

At any time, any of you may declare to me: "We have all visited the
switch room." If it is true (each of the 23 prisoners has visited the
switch room at least once), then you will all be set free. If it is
false (someone has not yet visited the switch room), you will all
remain here forever, with no chance of parole.

Devise for the prisoners a strategy which will guarantee their
release.
Good luck. 🙂

Rob
 
It's hard to figure out exactly what's being asked in the question, but I recall a similar riddle with the solution having something to do with the light bulb still being warm after the light has been turned out...
 
Originally posted by: BooneRebel
It's hard to figure out exactly what's being asked in the question, but I recall a similar riddle with the solution having something to do with the light bulb still being warm after the light has been turned out...
It's not a trick question at all...has nothing to do with the light bulb, etc.

Here's the cartalk link...I had to hear it twice before I understood what they were asking.

http://cartalk.cars.com/Radio/Puzzler/

The text (again, rephrased this time) of the question.

Cartalk Transcript:
RAY: I got this from my pal, Stan Zdonik, who teaches at Brown University. It was given to him by a colleague who failed to provide him with the answer -- maybe because he didn't know it?

Here it is.

This puzzle has been making the rounds of Hungarian mathematicians' parties.

The warden meets with 23 new prisoners when they arrive. He tells them, "You may meet today and plan a strategy. But after today, you will be in isolated cells and will have no communication with one another.

"In the prison is a switch room, which contains two light switches labeled A and B, each of which can be in either the on or the off position. I am not telling you their present positions. The switches are not connected to anything.

"After today, from time to time whenever I feel so inclined, I will select one prisoner at random and escort him to the switch room. This prisoner will select one of the two switches and reverse its position. He must move one, but only one of the switches. He can't move both but he can't move none either. Then he'll be led back to his cell.

"No one else will enter the switch room until I lead the next prisoner there, and he'll be instructed to do the same thing. I'm going to choose prisoners at random. I may choose the same guy three times in a row, or I may jump around and come back.

"But, given enough time, everyone will eventually visit the switch room as many times as everyone else. At any time anyone of you may declare to me, 'We have all visited the switch room.'

"If it is true, then you will all be set free. If it is false, and somebody has not yet visited the switch room, you will be fed to the alligators."

Here's the question:

What is the strategy the prisoners devise?

Rob
 
Sumamry of question:

23 prisoners.
2 switches with unknown position @ start
1 prisoner taken @ time to switches @ random time and in random order (same prisoner more than once in a row possably)
Prisoner MUST move one switch, and one switch only.
switches connected to absolutely nothing.
 
Originally posted by: Evadman
Originally posted by: Radiohead
There are FIVE lights! 😛

There are Four lights!

Doh 😱

Originally posted by: Entity
I heard this today on Cartalk and had to look up the answer. It's a simpler answer than I thought it would be, but was still out of my grasp.

Wow, after reading the answer... it was pretty simple; but yeah, not something I would have came up with easily...
 
Originally posted by: Evadman
Sumamry of question:

23 prisoners.
2 switches with unknown position @ start
1 prisoner taken @ time to switches @ random time and in random order (same prisoner more than once in a row possably)
Prisoner MUST move one switch, and one switch only.
switches connected to absolutely nothing.
Yeah, that's a good summary. Hope that helps someone out there. 🙂
 
Originally posted by: Evadman

switches connected to absolutely nothing.

Does that mean the switches not connected to light bulbs?

*EDIT* Also, do the prisoners know or see that one of them is being taken to the switch room? I know they cant talk to each other, but do they at least know someone is being taken to the room?
 
hmm, this is a tricky one.
I'm wondering if the figure 23 has anything to do with the problem, or if the solution would work for an arbitrary number of prisoners
 
My uncle told me a similar riddle with 100 guys and black and white hats. That solution involved odd and even numbers. This riddle sounds like it could be solved in a similar way.
 
Originally posted by: Haircut
hmm, this is a tricky one.
I'm wondering if the figure 23 has anything to do with the problem, or if the solution would work for an arbitrary number of prisoners

I was assuming arbitrary. Expecialy how the first explanation had this:
Each prisoner will visit the switch room arbitrarily often. That is,
for any N it is true that eventually each of you will visit the
switch room at least N times.)

The only thing I can think of is switching one switch so the switches are both "up" or "down" and if they match, switching one back the other way and doing some kind of counting sepending on weather they are up or down. but that doesn't work. it would give an amount of times other prisoners have gone to the swicthes, but not which prisoners. And you can not assign switch "positions" because there are only 4 possable combo's.

 
One thing that I thought of was to assign one switch, lets say B,to be a counting switch and the other one, A, to be a dummy switch.
We could then give one guy the task of being 'The counter'

If we say that the first time any man goes to the switch room he turns switch B to off if it is on, or just flips switch A if B is off.

We then say that every man, except the counter, switches B to on if he finds it off or switches A if B is already on the second time he enters the room.
After the second time they just switch A.

The counter switches B to off if he finds it on from his second time in the room onwards and if this is the case adds 1 to his count.
We now just have to wait for the counter to reach 22 and each man should have switched the switch and hence been in the room.

I'll check if this is right, but I reckon it must be something like this.

Edit, no this won't work.
 
That would work haricut.

Explained different way:

one man is set as counter and counts the number of times switch A is off. when a prisoner goes into the room, he switches switch A to off unless it is already off. If it is already off he just flips B to whatever to satisfy the "must switch a switch" And the next time he goes in, he will flip A to off. once he flipped it to off, then he will only flip the B switch.

every time the counter goers in, he will flip the A switch back to on so another prisoner can switch to off if he has not done it yet.

Count to 22 and you win.
 
We could get a situation where the counter would never reach 22 though.
If we have a situation where 11 of the men go in once.
Then these 11 go in again alternating with the 11 men who haven't been in at all the switch will get switched many times before the counter even sees it.
 
Originally posted by: Haircut
We could get a situation where the counter would never reach 22 though.
If we have a situation where 11 of the men go in once.
Then these 11 go in again alternating with the 11 men who haven't been in at all the switch will get switched many times before the counter even sees it.

you missunder stand. If the switch is already off (the counting switch) then it stays off. it is not switched again. the second prisoner see that someone already "counted" his trip into the room. the second prisoner will just flip the other one, and flip the counting switch when he goes in and sees it in the "non-counting" positon. After flipping it once, he will forever flip the non-counting switch.

it werks perfectly. that is what I got out of your post, or how I read it anyway 🙂
basicly, you will have one switch that is flipped a billion times. the other one will only be switched once by each prisoner. (and the counter putting it back in the other position)


<edit> someone PM me with a link or answer. I searched for "prison switch senareo" (but spelled right) and could not find anything except that carstalk link which does not have an answer. This has to be it. Nevermind, don't send. this only gives odds of 1:46 of death. not perfect.
 
OK, you have done it slightly differently to me.

I thought about doing it that way and you wouldn't be able to properly define a starting position for the counting.

If the counter goes in and switches A to off he doesn't know if that was the starting position of A, or if one of the other inmates has switched it to off first.
He may get suspicious when his count stays on 21 for a long time, but would never know for certain.

I'm sure if must be something like this, we just need to figure out the exact logic.
 
Originally posted by: Haircut
OK, you have done it slightly differently to me.

I thought about doing it that way and you wouldn't be able to properly define a starting position.

If the counter goes in and switches A to off he doesn't know if that was the starting position of A, or if one of the other inmates has switched it to off first.
He may get suspicious when his count stays on 21 for a long time, but would never know for certain.


Good point, I didn't catch that.

<edit>
The first priosoner in will just set it to the "counting" position. if it is already in that positon, then switch the other one. This would work for every prisoner being first excpet the "counter" That means there is a 1:46 chance that they all die as he would make everyone dead 🙂 acceptable odds.

I came up with those odds as if he is called first, and it is in the"coutning positon" then he will think someone was already there, and count an extra person. if it is up, he will know he is the first one in there, which is 2:1 odds on that switch position. I could live with 1:46 chance of death 🙂
 
Originally posted by: Evadman
Originally posted by: Haircut
OK, you have done it slightly differently to me.

I thought about doing it that way and you wouldn't be able to properly define a starting position.

If the counter goes in and switches A to off he doesn't know if that was the starting position of A, or if one of the other inmates has switched it to off first.
He may get suspicious when his count stays on 21 for a long time, but would never know for certain.


Good point, I didn't catch that.

<edit>
The first priosoner in will just set it to the "counting" position. if it is already in that positon, then switch the other one. This would work for every prisoner being first excpet the "counter" That means there is a 1:46 chance that they all die as he would make everyone dead 🙂 acceptable odds.

I came up with those odds as if he is called first, and it is in the"coutning positon" then he will think someone was already there, and count an extra person. if it is up, he will know he is the first one in there, which is 2:1 odds on that switch position. I could live with 1:46 chance of death 🙂

I don't see how this strategy will work at all. The goal is to make sure that EVERYONE has gone to the switch room already, not just that there has been 22 visits to the switch room. There can be a situation where two people just go back and forth to the switch room, and using the counting principle, you will call it waay too early.
 
Originally posted by: TuxDave
Originally posted by: Evadman
Originally posted by: Haircut
OK, you have done it slightly differently to me.

I thought about doing it that way and you wouldn't be able to properly define a starting position.

If the counter goes in and switches A to off he doesn't know if that was the starting position of A, or if one of the other inmates has switched it to off first.
He may get suspicious when his count stays on 21 for a long time, but would never know for certain.


Good point, I didn't catch that.

<edit>
The first priosoner in will just set it to the "counting" position. if it is already in that positon, then switch the other one. This would work for every prisoner being first excpet the "counter" That means there is a 1:46 chance that they all die as he would make everyone dead 🙂 acceptable odds.

I came up with those odds as if he is called first, and it is in the"coutning positon" then he will think someone was already there, and count an extra person. if it is up, he will know he is the first one in there, which is 2:1 odds on that switch position. I could live with 1:46 chance of death 🙂

I don't see how this strategy will work at all. The goal is to make sure that EVERYONE has gone to the switch room already, not just that there has been 22 visits to the switch room. There can be a situation where two people just go back and forth to the switch room, and using the counting principle, you will call it waay too early.

why? if the swicth is already off the prisoner leaves it off, and reserves his counting till later, and just flips the other switch. he will wait till later to flip the counting switch. that prisoner can go tot he room 200 times, and if each time, that switch is already int he "counting" position it stays there, and he waits his turn. it works perfectly except for taking into account if the counter is called first and the switch is already down, which give 1:46 odds. It works, I believe you are just missunderstanding the post.

<edit>
haricut PM'ed me the answer, and I looked. we were so fricking close it is not even funny. there is a simple way to take into account that the counter would be first, and the switch would be int he "coutning positon" and he would count an extra guy.
 
Back
Top