Here's a new brain teaser. The warden is a mathematician, and instead of arranging them randomly, he ensures that there is a cycle of at least 51. However he's not too cruel, so he tells the prisoners that he has done this.
I'm pretty sure that since this is less random than the original version the survival rate would go up, but I haven't figured out how to do this.
Well, you can parameterize this strategy with an arbitrary permutation P of {1, .. 100} in the following way. If you open box containing N, instead of next opening box N, you open box P(N). If the warden's placement of numbers defines permutation Q (box N contains Q(N)), then this new scheme will have each prisoner find his number if P composed with Q has no cycles of length greater than 50.
Now, if you randomly picked a permutation P, then by symmetry since you don't know anything about the placement of numbers, you'd do just as well as with the original strategy. On the other hand, what you've proposed is that the warden has told you that choosing P to be identity results in failure. So if you exclude identity and pick one of the other permutations for your strategy, you'll fare a little tiny bit better on average.
You can do even better than this by picking from a more specialized class of permutations for P. I'll leave the problem of finding the best class for P as a follow up.
If the boxes are in a random jumble when the prisoner enters, there may be no practical way of having 100 prisoners consistently assign an ordering from 1 to 100 for the boxes. The approach outlined will then fail.
Were I a particularly evil warden, I could meticulously place all the boxes in the same such "jumble" after each prisoner left. One of the prisoners would certainly derive a different ordering of the boxes than one of the other prisoners. The approach might still have a better than random chance of succeeding, but it would be lower than that outlined in the article, since there are now two (or more) chances for a cycle of length greater than 50.
For the people who would go for an analytical solution rather then monte-carlo: for a large number of prisoners the probability that they all find their numbers tends to 1 - ln(2) ~= 0.3069
I'm not seeing any obvious trick here. Trying it with just two prisoners, two boxes and one look, I can't see a way to do better than chance. I'm just wondering if it's something like the two envelopes problem, where you can on average do better by switching based on a monotonic function of the amount in the first envelope. Perhaps there is a way of picking the boxes based on your number that does better than average, even if its just a little bit. Any hints?
with 2 prisoners the probability of success is 0.5, so you are correct.
with 4 prisoners the probability of success is about 0.37, which is better than chance. (the probability of success turns out to be one minus the difference of two harmonic numbers.)
it's hard to give a hint without giving the answer. the best i can do is that it has to do with the structure of cycles in permutations.
I don't know the answer, but I think I know the general direction. And unless I'm mistaken, you're wrong about the "2 prisoners".
Semi-Spoiler alert
As I interepreted the parent post, he hasn't found a way, with 2 prisoners, to do better than the strategy of every prisoner picking a random box. Under that strategy, your chance of success is 0.25 - 0.5 * 0.5 (each has a 0.5 chance of being right).
So if, as you say, you can get the probability to 0.5 for 2 prisoners, you are doing better than chance. (And this I already know how to do, I'm assuming for more prisoners it's the same idea, but generalized).
There does exists a strategy to get %50 for two people (hint below). But the case of two people does not help much to solve the more general case (imho).
HINT:
Suppose each prisoner picks a box at random. They can (randomly) decide what box to open before they enter the room with the boxes, at a time when they can still communicate. In some cases they will then be able to determine that they have no chance of both finding their number. So there must be a better strategy.
You're right, a 0.5 strategy is better than random chance. Unfortunately, the simplest generalization of that strategy yields only 0.5^(n-1), which is not good enough - you need to start with a bigger base case.
Some hints (I hope they are not too revealing): Suppose the boxes are numbered. Also devise a scheme that will correlate the probabilities of success for the prisoners (i.e. success should not be independent).
I'm pretty sure that since this is less random than the original version the survival rate would go up, but I haven't figured out how to do this.