i think the 100 prisoners can only talk to each other together once for a strategy and then they can't communicate because if that weren't the case each one would just shout "i was in"

so here's the solution:

make one the master, only he may turn the switch on

if someone other goes in and
- the light is on he turns it off, but only if hasn't turned it off once, otherwise let it be

- the light is off let it be

each time the master turns the light on he counts one up
so if he counts to 99 all other were in there, but problem is what happens if light was off at beginning and master comes in first, would be a problem, or not?
no

each one may turn light off 2 times and master counts 2*99-1, so he might miss a second one from one person but that doesn't matter because everyone just has to be in at least once

this is out there, but here goes something that I made up: So, the first person goes in and breaks the lightbulb into 100+ pieces, and puts one in a line. Then, every prisoner that goes in henceforth puts one more piece in the pile. If/when there are 100 shards in that line, then somebody makes the claim that everybody's been in there and voila! everyone wins!

You've just lost twenty dollars and my self respect.

Rat wrote: so i sprinted back down this hill like a fucking mountain goat

First, pick the smartest person in the group to decide how long it will take for the bulb to burn out. Divide this number by 100, and have everyone leave the bulb on for that amount of time. When the bulb burns out, pray that the persons estimate was right, and claim everyone has been in.

You, and every other prisoner, will be shot if you violate the rules above.

Changed the puzzle to an easier version. Varient #1 is what I orginally posted.

Castaway wrote:

this is out there, but here goes something that I made up: So, the first person goes in and breaks the lightbulb into 100+ pieces, and puts one in a line. Then, every prisoner that goes in henceforth puts one more piece in the pile. If/when there are 100 shards in that line, then somebody makes the claim that everybody's been in there and voila! everyone wins!

If you see the light off, and n is not -1, turn the light on, and increment n.

If you see the light on, and n is not -1, turn it off, and decrement n.

If n=100, report that all prisoners have been in the room.

Note that the sum, over all prisoners, of that prisoners value for n is always 0 (if the light is off) or 1 (if the light is on). So the only way that n can ever reach 100 is if all other prisoners have n=-1, so if the report is ever made, it will be correct, since n=0 until a prisoner has entered the room. So we need only show that a report will eventually be made.

Note further that if some prisoner's n reaches -1, that prisoner never does anything again, and their value stays constant at -1. If we call such a robot inactive, the amount of active robots is decreasing. Also, if n is not -1, then either n=99 (so the next time they go in the room, assuming the light is off, n will reach 100 and they will win), or there is another active robot. If there are two active robots, then depending on who is randomly picked to be in the room in what order, either can have their value of n go up or down. If the one with the lowest value is repeatedly sent in when the light is on, turns it off, and someone with the higher n value is then sent in and turns it on, that robot will become inactive, so every robot has a nonzero probability of becoming inactive in at most 2*n+1 days. Since we have an infinite number of days to work with, each robot will, with statistical certainty, eventually become inactive unless they are the only remaining active robot, so with a statistical certainty, the robots will win, assuming the choice of robot is truly random.

I'm looking forward to the day when the SNES emulator on my computer works by emulating the elementary particles in an actual, physical box with Nintendo stamped on the side.

Yeah, if you run an optimization on the free parameters of a certain complicated model! These people have one hour to discuss it, and probably not a computer. I think the best they can hope for is a slight modification of Strategy 2, which (IIRC) gives them an expected time around 23 years.

Assumming a different person is chosen each time to go into the room, all they would have to do is wait 100 days. The person who goes in after the 100th supper would be able to say that they are the last one to go in the room.

Assumming a different person is chosen each time to go into the room, all they would have to do is wait 100 days. The person who goes in after the 100th supper would be able to say that they are the last one to go in the room.

They're chosen randomly each time, so the probability of that happening is 100!/100^100, or about 1x10^-42. Congratulations, you're all dead.

I'm looking forward to the day when the SNES emulator on my computer works by emulating the elementary particles in an actual, physical box with Nintendo stamped on the side.

Cosmologicon wrote:Yeah, if you run an optimization on the free parameters of a certain complicated model! These people have one hour to discuss it, and probably not a computer. I think the best they can hope for is a slight modification of Strategy 2, which (IIRC) gives them an expected time around 23 years.

I imagine that beats the hell out of my variant 2 strategy, where you have to wait for a random walk in n variables to hit some hyperplane 100 different times. Fortunately robots generally have long lifespans.

I'm looking forward to the day when the SNES emulator on my computer works by emulating the elementary particles in an actual, physical box with Nintendo stamped on the side.

hermaj wrote:Yakk, did you use the search function at all before posting this thread? I cannot help but think that this puzzle has been presented before - and for that matter, more than once.

If it's been posted long enough ago that people don't remember it, and many haven't seen it, what's the harm? It's not like people are reading through the puzzle archives, so sufficiently good puzzles merit reposting every now and then.

If people repost a puzzle from a few days ago or lower down the page, then that's kind of silly, but if someone posts a puzzle from a year ago, then the puzzle was probably interesting enough to be worth reposting.

I'm looking forward to the day when the SNES emulator on my computer works by emulating the elementary particles in an actual, physical box with Nintendo stamped on the side.

Yeah, if you run an optimization on the free parameters of a certain complicated model! These people have one hour to discuss it, and probably not a computer. I think the best they can hope for is a slight modification of Strategy 2, which (IIRC) gives them an expected time around 23 years.

Well, I guess it depends on whether you're willing to trade a shortened stay for a degree of uncertainty. I ran a few simulations of this situation 100,000 times, and the largest number of days I saw before all 100 prisoners had been to that room was 1,775 days (4 years and 314 days.)

Just to give you a few other sample statistics:

The smallest number of days I ever saw: 226 days
Average number of days needed: ~520 days
Median number of days needed: ~500 days
Number of days needed to be successful 99% of the time: ~915 days (~2.5 years)
Number of days needed to be successful 99.5% of the time: ~985 days (~2.7 years)

So, if they're willing to simply play the odds, they could get out in considerably less time.

The difference between intelligence and stupidity is that intelligence has its limits.

HiEv wrote:I ran a few simulations of this situation 100,000 times, and the largest number of days I saw before all 100 prisoners had been to that room was 1,775 days (4 years and 314 days.)

Just to give you a few other sample statistics:

The smallest number of days I ever saw: 226 daysAverage number of days needed: ~520 daysMedian number of days needed: ~500 daysNumber of days needed to be successful 99% of the time: ~915 days (~2.5 years)Number of days needed to be successful 99.5% of the time: ~985 days (~2.7 years)

So, if they're willing to simply play the odds, they could get out in considerably less time.

That's pretty good, but you can also do it by hand. For any large number of days N, the probability that you get them all in that much time can be estimated very well by 1 - 100(0.99^N). (The second-order term, which can be used as an upper-limit of the error on this estimate, is 4950(0.98^N).) So you can see that you have a 99999/100000 chance after 1604 days.

But of course this is a puzzle! When I'm telling it, I say the warden tells them, "If you make this claim, and you can prove that you are right, you are all free to go. If you make this claim, and you cannot prove it, you will all be killed."

I just realized that my favorite strategy (that takes about 23 years I think) works with Yakk's variant 2 but not with variant 1, that is, the prisoners must be able to keep time:

Basically it's just like SittingInTheDark's solution, except that the master is assigned at runtime. The first person who enters the room twice becomes the master, and gets a head start at counting everyone who's already been in the room once. In the first 100 days, nobody touches the light except that the master turns it off on her second visit. If someone enters the room in the first 100 days and it's on, they consider themselves counted, and if not, they just leave it alone. The master begins with the count set to the day before her second visit.

Cosmologicon wrote:Basically it's just like SittingInTheDark's solution, except that the master is assigned at runtime. The first person who enters the room twice becomes the master, and gets a head start at counting everyone who's already been in the room once. In the first 100 days, nobody touches the light except that the master turns it off on her second visit. If someone enters the room in the first 100 days and it's on, they consider themselves counted, and if not, they just leave it alone. The master begins with the count set to the day before her second visit.

This doesn't seem like it works.

If the first person who enters twice is the master, they need to know they're the first person to enter twice. If we assume the light starts on, then how does someone know if the light has ever been turned off, assuming that the light is on when they enter?

Also, when I first read the puzzle, I could have sword it said the intervals were also random, so that's the version I solved (well, the variant where they all follow the same strategy, and the intervals are random.)

I'm looking forward to the day when the SNES emulator on my computer works by emulating the elementary particles in an actual, physical box with Nintendo stamped on the side.

skeptical scientist wrote:Also, when I first read the puzzle, I could have sword it said the intervals were also random, so that's the version I solved (well, the variant where they all follow the same strategy, and the intervals are random.)

Edit:Changed it to an easier version of the same puzzle. The original version is one of the varients. Also cleared up the fact that the switch and the lightbulb are connected.

Yes, I changed it. I decided to post varients, and figured "why not post the easiest varient as the main puzzle".

Yes, an expected wait of 1,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000, 000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 times the estimated age of the universe is a little ridiculous, isn't it?

I'm looking forward to the day when the SNES emulator on my computer works by emulating the elementary particles in an actual, physical box with Nintendo stamped on the side.

Hey skeptical scientist, I think my solution works fine. I think if you reread it you'll understand, but I can explain if you need. Just remember that it only works if the prisoners can keep track of time! Yours is the best solution I've seen that works under both variants 1 and 2 simultaneously.

Cosmologicon wrote:Hey skeptical scientist, I think my solution works fine. I think if you reread it you'll understand, but I can explain if you need. Just remember that it only works if the prisoners can keep track of time! Yours is the best solution I've seen that works under both variants 1 and 2 simultaneously.

Nevermind, I missed the fact that nobody was allowed to touch the light in the first 100 days, except for the unique person who can turn it off.

If P#N has entered the room on day X and seen the light on, he knows that every prisoner from P#1 to P#X-1 has been in the room.

From then on, he turns the light on on days 1 through X-1 (but not on day X).

If X=N, then he turns the light on on days 1 through X.

This changes the expected wait time quite considerably.

It takes 100 iterations for prisoner #1 to be on day 1.

This almost certainly then results in two people knowing about prisoner #1.

Knowledge that prisoner #1 has been in the room then grows hyperbolicly.

When either of the two people enters the room on day 1, they have a 98/100 chance of informing someone else that someone else has been in the room.

Then a 97/100. Then 96/100.

As #1 stays on more and more, #2 becomes more and more likely to see it. Once he leaves the light on, the number of people who know about #2 grows at a similar rate.

Not sure what the exact bound is, but is is much better than 100^100.

Yeah, uh, Yakk, I'm still not impressed by the efficiency of your algorithm. In a world where exptime algorithms are considered bad, an algorithm which takes o(n!) time is beyond silly, and even a huge improvement is still a really bad algorithm.

Edit: although I have to say, there is something appealing about tremendously bad algorithms. It's like the origin of Graham's number. A bad upper bound is boring, but a hideously bad upper bound is funny.

Yakk wrote:So this places an upper bound on the time it takes to solve the problem using my refinement at 100^3! A pretty good speedup from 100^100 eh?

Assuming you're right about this, you've brought the time down from an absurd power of 10 times the age of the universe to roughly 1/3 of the age of the universe. An impressive speed-up, to be sure, but still slightly impractical.

I'm looking forward to the day when the SNES emulator on my computer works by emulating the elementary particles in an actual, physical box with Nintendo stamped on the side.

An eyeblink. :) I'm sorry if you exist in an 8000 year old universe, but I'm communicating to you from a far older one. Understanding the inter-universe communication method would make an interesting project. Are there any wormholes on your internet connection?