100 Prisoners and a Light Bulb (one of possible solutions) I was reading one of the possible (not the most efficient) solutions to the following problem:
"There are 100 prisoners in solitary cells. There's a central living room with one light bulb; this bulb is initially off. No prisoner can see the light bulb from his or her own cell. Everyday, the warden picks a prisoner equally at random, and that prisoner visits the living room. While there, the prisoner can toggle the bulb if he or she wishes. Also, the prisoner has the option of asserting that all 100 prisoners have been to the living room by now. If this assertion is false, all 100 prisoners are shot. However, if it is indeed true, all prisoners are set free and inducted into MENSA, since the world could always use more smart people. Thus, the assertion should only be made if the prisoner is 100% certain of its validity. The prisoners are allowed to get together one night in the courtyard, to discuss a plan. What plan should they agree on, so that eventually, someone will make a correct assertion?"
The suggested solution: 
"Each prisoner gets assigned a number from 1 to 100. (Numbers not to repeat). The days are counted from 1 to 100, then the counting recommences at 1. (I.e., the day 101 will be considered as day 1 again.) Each prisoner has a table drawn with a cell for each of the 100 days. If a prisoner numbered i is taken to the room on Day i (same i), he switches on the light. If not, he leaves the room with a light switched off. When entering the room the prisoner checks at first if the light has already been on. If that's the case, he can tick off the previous day. If a prisoner "n" comes on a Day k, and he knows from his list, that the person "k" has already been in the room on Day k, he also switches the light. 
Whoever's list becomes full, speaks out." 
So far so good. But then, the author is trying to calculate how long this could last:
"the disadvantage is that this approach could last for a max of 100!*100! days. The first 100! so that all prisoners are brought in on the first 100 days, the second 100! so that the numbers of the days and prisoners coincide.It may be that it can last even longer as I'm (the author) not taking into account that the counting recommences exactly every 100 days (e.g., everyone may have visited the room from day 50 to 150 but not afterwards.)"
I'd like to start a discussion considering the last paragraph. The following thoughts are my own, so please correct them.
1) max time 100!*100!: First of all, the procedure may take forever! It may happen that at least one prisoner never enters on the day designated for him. Moreover,if the prisoners have already been assigned a number then there is only 1 way how to place the prisoners s.t. all numbers coincide. Thus, 100!*1 (100! ways to assign the numbers but then it's fixed, thus, *1). But even then I wouldn't say that 100!*1 is a duration, it's just a number of combination. Am I right?  
2)I understand the idea s.t. a prisoner with a number 1 is desired to enter the room on days 1, 101, 201 etc. The only remark is that the days 101, 201 etc.are denoted as 1. Then, why do we need all prisoners on exactly the first 100 days? (author's explanation of 100!). The lists made by the prisoners will not be erased once the first 100 days elapsed but they'll be carried forward.
3) Regarding the solution's last sentence (a remark about prisoners all brought in from, say,day 50 to 150). Does the author mean that even if they all do enter the room, the result will be spread over the 100 lists and noone will have a full list? 
4) What would the average time of this solution be? I think that we can only calculate it by simulation. Because prisoners repeat themselves, plus it may be that, e.g., a prisoner N is brought on a correct day for the second time but the following prisoner M has already been behind the prisoner N, thus, no new ticks in the list. The probability of repetition will increase with time, etc. Thus, simulation?   
Thank you in advance!
 A: You are correct that there is no hard maximum time. If prisoner $i$ is always taken to the room on day $i+1$ the light will never go on.  
I think computing the expected time is hard, but we can get an idea if we think about how many people have $i$ on their list. We can assume each person starts with himself on his own list. To get $i$ on another list, we must have prisoner $i$ go to the room on day $i$, which happens with probability $1/100$ in each $100$ day span. Once he is on two lists, the chance he gets on a third is $\frac 2{100}\cdot \frac {98}{100}$ because one of the two must go to the room on day $i$ and somebody else must go on day $i+1$. If he is on $j$ lists, the chance to get on another is $\frac j{100}\cdot \frac {100-j}{100}$. I find it takes on average about $103,500$ days to get on all the lists. That is the scale we are looking at, but we want the first complete list, not somebody on all the lists. We note that a person can only fill slot $j$ on his list when he visits on day $j+1$ so if somebody starts with a blank list and the light is always left on, it will take on average $100^2\log 100 \approx4 6000$ days to fill the list from the coupon collector problem. Clearly the expected time does not involve $100!$. It is in the range of simulation.
