## 5 Star Logic Problem (100 prisoners and a light bulb)

so far the only way i can see of "solving" it is using probability
however i dont believe this is a valid solution as the question stipulates that the declaration must be 100%
and one thing i know about probability is that if i flip a coin 10^10000000000 times i cannot say 100% that it wont heads every time.

therfore the prisioners could spend infinity^infinity eons locked up and still not be sure 100%

so there must be a soln that does not rely on prob or silly invention
i think this one may drive me crazy

 I think I've figured out the answer. Since they all get to meet together before they go in their cells what they will do is they wil devise a plan where the person who's cell is closest to the room's entrance will be the person who'll know how many people have gone. what happens is even though at the time they may not know who is going to be closest until they receive their cells is that the person going by the cell and into the room with the bulb wil shout out his/her name while walking by. If the person has already gone then they will say nothing. The person in the cell closest will keep track of all the names called in one way or another and when all 100 have called out their names and finally the person closest goes after al names have been said he/she will tell the guards they all have went. Depending on how many days it takes for everyone to go then there is no possible way to tell exactly how many days before their final day in the facility.
 assuming all prisoners can count the days: each toggles the switch everyday if your called on an odd day the switch should initally be on if your called on an even day the switch should initally be off if your called twice within 100 days you leave the light bulb as it is alerting the next guy that someone was called twice by destroying the correspondence between odd-on even-off [we call this guy THE MASTER] the next guy continues to alert everyone that its a bum deal by continuing to toggle the switch all prisionsers will know that its bad because on/off dont match with the even odd days. UNTILL the original guy who was called twice returns having counted at least 100 days since his last visit. he now restores order (off for odd days on for even days). the system is reset each prisioner again toggles the switch on for odd days off for even days again, if one man is called twice within 100 days he leaves the switch destroying the order.[HE BECOMES THE MASTER] finally when our man [the master] who restored the order returns, again having counted 100 days at least and seeing that odd/even days match with on/off he knows that no one prisioner has been called twice in the last 100 days. and seeing as there is only 100 prisioners this means that each prisioner must have been called at least once. he declares this and is promplty taken out to the back of the pump house and shot! now where do i collect my prize (probably at the back of the pump house?! :) )
 also i note from my post above that by the time dude decalers that all prisioner have been at least once, it may be several years since the event actually occuring. but he does not know this, not 100%
 also i just read akg's post #2 properly and i think if he and i were prisoners i'd rather go with his method! 28 years is easssyyy time
 My Solution: 1. First prisoner who goes to central room acts as counter and he leaves the switch as it is i.e off 2. Different prisoner goes to central room turns the light on if it is switched off and he/she should not turn it on/off from then, even he/she gets chance to enter central room again(goes to infinity).. 3. Different prisoner goes to central room leaves the light as it is, if it is switched on 4. So whenever the first prisoner gets chance to go to central room again,he will count 1 if the light is switched on and make the switch off. 5. when the first prisoner who is counting gets 99,then he will tell that all 100 prisoners have been to the central room This method takes a long long time but will work. please tell me if there are any mistakes

 Quote by NeutronStar Well, I didn't know how to do that math, but I do know how to program a computer. So I wrote a simulation of AKG's method. After running the program several times (each time the program averages 1000 runs) I got a pretty consistent result. The most likely number of days that the prisoners would serve would about 10,420 days. That a little over 28 years. That's the most likely amount of time they would serve using AKG's method. If you'd like to see my program I'll be glad to post it. I wrote it in Visual Basic and it's quite short. There's probably some way to do this directly using probability mathematics.
I've done a script in PHP. Running 10000 Trials the results come out to:

Max: 14348
Min: 6780
Avg: 10010.3376

So this number is very close to 10000 which is correct even intuitively seeing that the counter person has to come back to the room 100 times at a rate of 1/100 of him being chosen. Equals to 100x100 = 10,000 days.

 Once a prisoner is called, he goes in and he can either turn the light on or off, it doesn't matter. Once he's done this, he'll kill himself. Since he can't be called again, the warden must call another person. That person will go in, and then kill himself. This will continue, for about 99 days, and on the 100th day the last person will enter and say, "all 100 have entered if you include me." Pretty gruesome, I know, but it works (I think).

 Quote by aragorn1r Since he can't be called again, the warden must call another person.
I'm not sure that works-- I don't see anything in the OP that restricts the warden into choosing living prisoners:

 Everyday, the warden picks a prisoner at random, and that prisoner goes to the central living room.
I suppose it would work if one assumed that a dead person was incapable of being a prisoner and was instead a "former prisoner".

DaveE

 Quote by spidey My Solution: 1. First prisoner who goes to central room acts as counter and he leaves the switch as it is i.e off 2. Different prisoner goes to central room turns the light on if it is switched off and he/she should not turn it on/off from then, even he/she gets chance to enter central room again(goes to infinity).. 3. Different prisoner goes to central room leaves the light as it is, if it is switched on 4. So whenever the first prisoner gets chance to go to central room again,he will count 1 if the light is switched on and make the switch off. 5. when the first prisoner who is counting gets 99,then he will tell that all 100 prisoners have been to the central room This method takes a long long time but will work. please tell me if there are any mistakes
There is a common mistake in many of these plans, namely the assumption that a prisoner will know that he is "first" (or WHO is first).

 Doesn't need to know if he's first, once he's been in the living room, he kills himself. This goes on for 100 days. The only person left at the last 100th day is the only one who will walk free.

 Quote by davee123 I'm not sure that works-- I don't see anything in the OP that restricts the warden into choosing living prisoners: I suppose it would work if one assumed that a dead person was incapable of being a prisoner and was instead a "former prisoner". DaveE
If he's dead, he's got to buried you know. It's not like you let him rot in his cell.

 Quote by aragorn1r If he's dead, he's got to buried you know. It's not like you let him rot in his cell.
I figure they'll just cremate him and take his urn into the room.

DaveE

 Begin with Phlegmy's #71 post of even/odd days for (say) 100 day intervals. The first repeat prisoner will reverse the order. The SECOND repeat prisoner becomes counter and begins "regular" (post #2) strategy, starting at the next 100 day (100 is probably not optimal) interval. (There MUST be a second repeat prisoner by day 100). This plan may need some work, but I like the odd/even idea......
 To clarify, strategy is two parts: days 1-100 use even/odd method and designate Counter (second repeater); days 101 till end is "regular" (post#2) strategy. They won't know who Counter is, but they'll know who it ain't (them). When the first second repeater leaves room, he resets to original even/odd days, so that any future second repeaters know they're not Counter. Now if I could only figure out the average time till second repeater and.....
 English is not my first language so sorry for some mistakes something isn't accurate with the problem. read this problem and there is some similarity between these 2 problems The riddle: 100 prisoners. tomorrow will be stood by a line: the 100th one can see other 99, 99th other 98, 2nd-only first one and 1st can't see anybody. each of them will wear a hat either black or white, and nobody can know his color. the count of each color is unknown it can be 50bl 50wh or 100bl 0wh or 73bl 27wh etc., they have to say the color of their hat, using words "black" or "white" no other words and can't prompt others with the intonation. who says wrong will be killed. 1st will begin the 100th one then 99-98-97. . .-1 Q: Knowing all this what plan can they make at night for the tomorrow's issue in order to survive AT LEAST 99 prisoners???

 Quote by AKG One person is chosen as the counter. If the light switch is on, no prisoner will touch it. If it is off, and a prisoner who has never flicked the switch enters, then he flicks the switch on. It stays like that until the counter returns. The counter never flicks it up, only flicks it down. Once he notices that it's been flicked up 99 times, he says that 100 prisoners have visited, and they go free.
I know this is an old thread, but it struck me that 'optimal' could be reached by combining more than one strategy. I saw good and other solutions in this thread, but hardly any cooperation between users to reach a more optimal solution.

I suggest a different strategy that happens for only the first 100 days: the first to come into the room switches on the light. The second person leaves the light on unless it is the same person who came in the room the first day. The 3rd person also leaves the light on unless he is the person who was there day one or day two. Same for the 4th, 5th, 6th, etc. In fact they all leave the light on UNTIL someone comes in for the second time while the light is on within those first 100 days. This person switches the light off and becomes the counter.
Once the light is off, the group has to wait for day 101 to indicate to people on later days that the first strategy has stopped working. From day 101 on I use the above AKG strategy. Anyone who was in the room and switched on the light during this first cycle does not switch the light on again, ever. This extra strategy gives the counter a head start. (It even gives the group the possibility, albeit a small one I agree, to get out in 100 days.)

Example: the first 30 people to go in the room leave the light switch on, because they all went in the room only once. Person 31 is in fact the person who went in day 8 so he switches off the light, so next persons know the chain is broken. Everyone now leaves the light off until day 101. Then they start the above AKG strategy with person 31 being the counter, having already 30 on his tally. Only 70 more to go. Without doing the math I think it's quicker to use this extra strategy.