Suppose we roll a fair die until some face has appeared twice. For instance, we might have a run of rolls 12545 or 636. How many rolls on average would we make? What if we roll until a face has appeared three times?
I calculated the expected value for getting a repeat for a six-sided dice and I got 1223/324 (3.77 tosses). How would we generalize this to an $n$-sided dice? What about $k$-repeats?
Start with $n$-sided fair die and take $k=2$ (i.e. waiting till a face shows up twice).
For $i=0,1,\ldots,n$ look at the situation in which exactly $i$ faces have not shown up yet, and denote the expectation of the number of rolls yet to come by $\mu_{n,i}$. Then we have the relation:
Here $\mu_{n,0}=1$ and you are looking for $\mu_{n,n}$.
Based on this relation it is easy to show that:
So we have: