Problem:
A calculator has a display, which shows a nonnegative integer , and a button, which replaces by a random integer chosen uniformly from the set , provided that . Initially, the display holds the number . If the button is pressed repeatedly until , what is the probability that the numbers , and will each show up on the display at some point?
Solution
Solution:
First, we claim that if the display starts at some , the probability that any given number will appear at some point is . We can show this by induction on .
If (the base case), can only be reached if it appears after the first step, and this occurs with probability .
If and the claim holds for , then there are two possibilities starting from . If the first step leads to (this occurs with probability ), the probability of seeing subsequently is by the induction hypothesis. If the first step leads to something less than (probability ), then it leads to any of the integers with equal probability. But this is exactly what the first step would have been if we had started from ; hence, the probability of seeing is again by induction. Thus, the overall probability of seeing is
proving the induction step and the claim.
Now let () be the probability of eventually seeing the number if we start at ; note that this is the same as the conditional probability of seeing given that we see . Hence, the desired probability is