Talk:100 prisoners problem

Creation request
The following request was added some time ago to Requested articles/Mathematics, which I have now moved here:
 * The condemned prisoners and the boxes Fun problem with surprisingly simple solution. See for example http://www.mast.queensu.ca/~peter/inprocess/prisoners.pdf

This source might be added to the article if it adds anything. Frieda Beamy (talk) 17:52, 30 June 2014 (UTC)
 * Thanks for the notice, but the article has better sources. Best wishes, --Quartl (talk) 18:07, 30 June 2014 (UTC)

Example
The first example is as follows:

The prison director has distributed the prisoners' numbers into the drawers in the following fashion


 * {| class="wikitable" style="text-align:center"


 * style="background:#FFEBAD;" align="left" | number of drawer ||  1   ||   2   ||   3   ||   4   ||   5   ||   6   ||   7   ||   8
 * style="background:#FFEBAD;" align="left" | number of prisoner || 7 || 4 || 6 || 8 || 1 || 3 || 5 || 2
 * }
 * style="background:#FFEBAD;" align="left" | number of prisoner || 7 || 4 || 6 || 8 || 1 || 3 || 5 || 2
 * }

The prisoners now act as follows:


 * Prisoner 1 first opens drawer 1 and finds number 7. Then he opens drawer 7 and finds number 5. Then he opens drawer 5 where he finds his own number and is successful.
 * Prisoner 2 opens drawers 2, 4, and 8 in this order. In the last drawer he finds his own number 2.
 * Prisoner 3 opens drawers 3 and 6, where he finds his own number.
 * Prisoner 4 opens drawers 4, 8, and 2 where he finds his own number. Actually, this was already known to prisoner 1.
 * That prisoners 5 to 8 will also find their numbers can also be derived from the information gained by the first three prisoners.

- Unless I'm missing something, Prisoner 4 is a maverick, Prisoner 1 is psychic, and Prisoner 2 is forgetful:

1)"Prisoner 4 opens drawer 4, 8 and then 2." Prisoner 2 has already indicated that number 4 is in drawer 2 so Prisoner 4 could have just opened that directly. Why does Prisoner 4 open two more drawers? Drawer 4 we already know contains the number 8 and drawer 8 is already open/empty/out of the game as Prisoner 2 found their number in it. If all the combinations were not known there would be an advantage to not going directly to your number, as opening your allotment (not the allotment - 1 as Prisoner 4 does here) would provide more information for the subsequent prisoners, but in this case all the drawer/number combinations have already been identified. Poor Prisoner 4.

2)"Actually, this was already known to prisoner 1." Prisoner 1 opened drawers 1,7, and 5 so how would they have known that drawer 2 contained number 4? "Prisoner 2 opens drawers 2, 4, and 8 in this order." So it was Prisoner 2 not Prisoner 1 that knew drawer 2 contained number 4.

I am as mathematical as I am musical (Lalahalah-sqreeKK-La), so I'm quite prepared to be told I haven't understood, but in that case the examples could do with fleshing out. Belle (talk) 08:05, 1 July 2014 (UTC)


 * The prisoners are not allowed to communicate with each other. Maybe the phrase "was already known" is misleading, I'll reformulate it. Best wishes, --Quartl (talk) 08:11, 1 July 2014 (UTC)
 * Sorry, it seems I mixed up prisoners 1 and 2. Thanks for pointing this out. --Quartl (talk) 08:16, 1 July 2014 (UTC)
 * Ahhhhhhh, I see. I thought the prisoners were observing the previous attempts...You should probably remove "Actually, this could have been derived from the information gained by prisoner 2", because the prisoners could not have derived it and the observer can only derive it by altering the parameters of the problem. It's confusing for mathematical dummies like me and probably not helpful for maths types. Belle (talk) 08:31, 1 July 2014 (UTC)
 * At this point, a change of perspective from the prisoners' view to an outsider's view is made. Actually, this change of perspective is intentional, since we don't want to carry out the same computations again and again. Do you think it would be more instructive to state all opened drawers for all prisoners first and afterwards argue that an outside observer would have known that the prisoners will survive already after the third one? Best wishes, --Quartl (talk) 08:49, 1 July 2014 (UTC)
 * I made the change of perspective clearer in the article. --Quartl (talk) 09:17, 1 July 2014 (UTC)
 * Yes, that's better. (Now I've re-read it, it is clear that the remaining prisoners do not see the previous attempts. It was early, I hadn't had coffee. Excuses, excuses). Belle (talk) 09:24, 1 July 2014 (UTC)
 * Don't worry, your remarks were certainly helpful. It is a difficult subject. Best wishes, --Quartl (talk) 09:37, 1 July 2014 (UTC)

New section on individual probability of success.
Does following this strategy alter the individual's probability of finding a randomly placed number? If you may open 50% of the drawers randomly, then you have a 50% chance of success. If you follow chains, and the probability that ALL chains are shorter than 50% of the total is 31% (and thus a 31% probability that ALL prisoners will be successful in finding their number is 31%), then is the probability that a chain longer than 50% of the drawers exists AND you choose that chain such that the probability for the individual finding their number still 50% ?

Thecheckboard (talk) 13:20, 16 December 2014 (UTC)


 * The success probability of an individual prisoner using the cycle-following strategy is still 50%. This probability can be derived as follows:


 * If the length of the longest cycle is at most 50, then the success probability is 100%.
 * If the length of the longest cycle is exactly 51, then the success probability is 49%.
 * If the length of the longest cycle is exactly 52, then the success probability is 48%.
 * If the length of the longest cycle is exactly 99, then the success probability is 1%.
 * If the length of the longest cycle is exactly 100, then the success probability is 0%.
 * If the length of the longest cycle is exactly 100, then the success probability is 0%.


 * Therefore, the total success probability of an individual prisoner using the cycle-following strategy is


 * $$(1-H_{100}+H_{50}) + \sum_{n=1}^{50} \frac{1}{50+n} \cdot \frac{50-n}{100} = (1-H_{100}+H_{50}) + (H_{100}-H_{50}-\tfrac{1}{2}) = \tfrac{1}{2}$$


 * Most probably there is an easier way to compute this probability, but that is the direct approach :-). Best wishes, --Quartl (talk) 17:30, 16 December 2014 (UTC)

Requested move 7 March 2018

 * The following is a closed discussion of a requested move. Please do not modify it. Subsequent comments should be made in a new section on the talk page. Editors desiring to contest the closing decision should consider a move review. No further edits should be made to this section. 

The result of the move request was: no consensus to move the page at this time, per the discussion below. Dekimasu よ! 02:49, 20 March 2018 (UTC)

100 prisoners problem → Locker Puzzle – There are a lot of problems about 100 prisoners, there is no evidence that "100_prisoners_problem" would be recognized as this problem. "Locker Puzzle" is more recognized name. It looks like in all references where this problem is referred by a name it referred by "Locker Puzzle" starting from Curtin and Warshauer's paper Alexei Kopylov (talk) 23:37, 7 March 2018 (UTC) --Relisting. — usernamekiran (talk)  19:06, 14 March 2018 (UTC)
 * "Locker puzzle" isn't any less ambiguous. The article subject is referred to as "100 prisoners problem" in the secondary literature by very respectable authors, such as Flajolet/Sedgewick and Stanley, which should be enough to justify the title. 2A01:598:A005:BBC9:1:1:580A:EC48 (talk) 14:48, 10 March 2018 (UTC)


 * The above discussion is preserved as an archive of a requested move. Please do not modify it. Subsequent comments should be made in a new section on this talk page or in a move review. No further edits should be made to this section.

Loops creation
Some important points in the loop strategy are:
 * 1. In fact there are always single-chain closed loops in the box chains, they cannot be open chains that do not loop back at some point, and all the boxes in a chain are in a single round loop with no intersections. The next sections clarify this point so that it is intuitively understood.


 * 2. The last box in the loop, loops back to the first box you started at. That's actually the same thing as point #1 above, but looking at it from a different angle. So...


 * 3. If you start at the box of your number, the last box in the loop will necessarily be the one that loops back to you, and thus, the distance to the box that loops back to your starting box, is the distance to the box with the slip that has your prisoner number in it. In other words, you must traverse the full length of the chain to get to your number in the box (which then leads back to the box marked externally with your number, which you started from). פשוט pashute ♫ (talk) 16:56, 10 July 2022 (UTC)

Probability by cooperative strategy
The strategy causes the probability to go up, because the prisoners are cooperating in a way that avoids double choices. To intuitively show this, let's consider 3 numbered players with 3 similarly numbered balls in unmarked boxes and a single chance to choose their box.

Without a strategy each player has 1 choice out of 3, and for all to succeed would be (1/3)^3. But if they decide to avoid each other's box, where player1 chooses box1, player2 chooses box2 and player3 chooses box3, then after the success of the first player (with a 1 out of 3 chance), the second player is choosing only from two balls in two boxes. They have cooperated in advance and avoided each other's choice. Player2's chances are 1/2. And once player 2 succeeds player 3 NECESSARILY succeeds. So the chances of success are now 1/3 x 1/2. Much better than the initial 1/27!

Put another way, we are looking at the chances of getting an ordered three letter word using three different letters. Its ABC out of ABC, ACB, BAC, BCA, CAB, CBA or the probability of one out of six: 1/6. פשוט pashute ♫ (talk) 16:56, 10 July 2022 (UTC)

Half the prisoners for half the boxes
Similarly in the prisoners riddle, if more than 50 prisoners chose the strategy of checking the first 50 boxes, they would NECESSARILY fail. They are cooperating in advance to continue looking in the first 50 boxes, even though either a prisoner before them failed, and therefor their effort is futile, or all first 50 prisoners succeeded and therefor the rest of the prisoners cannot have their number in one of the first 50 boxes!

If on the other hand the first 50 prisoners would all choose to check the first 50 boxes, and the second half of prisoners check the other 50 boxes, then once the 50 prisoners succeeded, the other half would necessarily succeed, immensely improving the chances of winning from (1/2)^99 to (1/2)^50.

The advancing strategy
Let us look at a strategy of avoidance in a similar game to ours, but with only 6 numbered players and 6 numbered balls, in 6 numbered boxes, with the chance to open 3 boxes each time, and no discussion of what happened in the room is allowed. Here too, the players succeed only if every one of them successfully finds their player's number on a ball in one of the boxes they checked. This is the same as the prisoner game but with players and balls.

The new strategy is simple: Each player starts from the box with their player number, and chooses the next 3 (in a loop back to 1 after 6):
 * Player1 opens boxes 1, 2 and 3.
 * Player2 opens boxes 2, 3 and 4
 * Player3 opens boxes 3, 4 and 5
 * Player4 opens boxes 4, 5 and 6
 * Player5 opens boxes 5, 6 and 1.
 * Player6 opens boxes 6, 1 and 2.

Analysis: - Note: The positions are from two places before, and until the number. So number 4 can be in positions 2, 3 and
 * Possible words 543210 543201 543120
 * Possible numbers in each position are: 1:(123) 2:(234) 3:(345) 4:(456) 5:(561) 6:(612).
 * Possible number orders are: abc, acb, bac, bca, cab, cba.
 * Possible positions for each number are: 1xx.x11 22x.xx2 333.xxx x44.4xx xx5.55x xxx.666

Possibilities: x marks a failing box chain. v marks a successful one
 * v:123.456!! Otherwise x:123.nnn (x44.4xx and xx5.55x - meaning 4 can't be anywhere else and 5 can't be last)
 * x:132.nnn (22x.xx2 - meaning 2 cannot be on position3)
 * v: v:134.562, v:134.652. Otherwise x:134.nnn, (22x.xx2 meaning 2 can only be in position6)
 * v:135.462. Otherwise x:135.nnn (22x.xx2 and x44.4xx)
 * v:136.452. Otherwise x:136.nnn (22x.xx2 and x44.4xx)
 * x:142.nnn (22x.xx2)
 * v:143.562, v:143.652. Otherwise x:143.nnn (22x.xx2 - meaning 2 only in last position)
 * x:145.nnn. (333.xxx), x:146.nnn (333.xxx)
 * x:15n.nnn (xx5.55x), x:16n.nnn (xxx.666)


 * v:213.456 otherwise x:213.nnn (x44.4xx and xx5.55x)
 * x:214.nnn. x:215.nnn, x:216.nnn (333.xxx)


 * v:231.456, x:231.nnn (x44.4xx, xx5.55x)
 * v:234.516, v:234.561, v:234.615, v:234.651. But x:234.1 (1xx.x11)
 * v:235.416, v:235.461. Otherwise x:235.nnn (1xx.x11, x44.44x)
 * x:236.nnn, (xxx.666)
 * x:241.nnn (1xx.x11)
 * v:243.516, 243.561, 243.651. Otherwise x:243.nnn x:(.1nn, .615)
 * x:245.nnn and x246.nnn (because 333.xxx)
 * x:25n.nnn (xx5.55x) and x:26n.nnn (xxx.666)
 * x:31n.nnn (1xx.x11) and x:321.nnn (1xx.x11)
 * v:324.516, 324.561, 324.651.
 * - But not: 324.1nn (1xx.x11) and not 324..615 (xx5.55x)


 * v:345.612. But not x:345.1nn (1xx.x11) or x:345.2nn or x:345.62n (22x.xx2)
 * x:346.nnn (xxx.666), and x:35n.nnn (xx5.55x), and x:36n.nnn (xxx.666)

None of the next are possible:
 * x:4nn.nnn (x44.4xx),
 * x:5nn.nnn (xx5.55x),
 * x:6nn.nnn (xxx.666)

So there are 19 options out of 730 (6x5x4x3x2) that all players will find their ball within 3 openings (which means after opening half of the boxes) = 0.2%, as opposed to a random game with chances of 0.000026 (1 /  6x6x6 x 6x6x6).

That's improving the chances of success by more than 1000 times!! פשוט pashute ♫ (talk) 16:56, 10 July 2022 (UTC) פשוט pashute ♫ (talk) 16:56, 10 July 2022 (UTC)

Counting cases justification
I just wanted to put here that the justification in this sentence threw me off: "Within this cycle, these numbers can be arranged in (l-1)! ways since there are l permutations to represent distinct cycles of length l because of cyclic symmetry."

It made me think about representations of symmetric groups which maybe shouldn't be the point. Figuratively, we simply choose l drawers and "for the first drawer we have l-1 choices, for the second l-2..." Thx 4 readin'. 84.190.104.60 (talk) 01:24, 5 April 2024 (UTC)

Credit
We say "The 100 prisoners problem was first considered in 2003 by Danish computer scientist Peter Bro Miltersen who published it with Anna Gál."

In looking at the paper, and several of the sources, I've been unable to find a reason why Peter Bro Miltersen is given primary credit for this, and Anna Gál only mentioned afterwards. Is there a reason for this? Jimbo Wales (talk) 16:11, 16 April 2024 (UTC)


 * I'll go WP:BOLD with changing that, and let's see if anyone comes forward with the answer. — Q uantling (talk &#124; contribs) 16:34, 16 April 2024 (UTC)