Solution:
They can use the following strategy: each prisoner opens the box labeled with his own number. He then looks at the number on the paper inside and opens the box labeled with that number next. He continues doing so until he finds his own number or he has opened 50 boxes. For instance, prisoner 2 might open box 2 and find the number 5, then open box 5 and find the number 17, then open box 17, and so on.
Thus, the prisoners will win iff the permutation of paper numbers in box numbers has no cycle of length more than 50. If the permutation does have such a cycle, it has at most one, and its length could be 51,52,…,99, or 100. If the cycle has length n, then there are 100!/n possible permutations, since there are
100⋅99⋯⋅(100−n+1)
ways to choose the numbers in the cycle (in order) and (100−n)! ways to permute the remaining numbers, but then we divide by n since it doesn't matter to the permutation which of the n numbers is first when we write out the cycle. Thus, the probability there is a cycle of length n>50 is 1/n for each n. There is at most one such cycle, so the total probability is
511+521+⋯+1001=(1+21+31+⋯+1001)−(1+21+31+⋯+501)≈ln100−ln50=ln2≈30%.