Suppose you have 3 dice, and you want to have 3 of a kind. Initially, you roll them all, then you can re-roll some of them until you get 3 of a kind. Rolling multiple dice at once counts as 1 roll.
Example:
2, 4, 5 -> re-roll all dice
3, 3, 1 -> re-roll the 1
3, 3, 5 -> re-roll the 5
3, 3, 3 -> 3 of a kind obtained in 4 roll.
What is the average number of rolls needed to get 3 of a kind ?
My progress so far:
I wrote a program to do it 100000 times and get the average, it outputs ~7.9 rolls.
I classified the hand (a,b,c) in 3 different categories:
- B1, a != b != c
- B2, a = b != c (2 of a kind)
- B3, a = b = c (3 of a kind)
The probability of changing to another class when rolling in B1:
- Staying in B1: 5/9
- Changing to B2: 5/12
- Changing to B3: 1/36
Same for B2:
- Changing to B1: 0
- Staying in B2: 5/6
- Changing to B3: 1/6
But i couldn't find an exact formula for the average rolls.
Let $X$ be the random variable that represents the number of rolls until having a three of a kind. To compute its expectation, we condition on the first roll and denote by $Y$ the number of different results we got.
If we got three of a kind ($Y=1$ w.p. $\tfrac{1}{6^2}$), $X=1$ and the expected number of additional rolls is $0$.
If we got two of a kind ($Y=2$ w.p. ${3 \choose 2} \tfrac{5}{6^2}$), we continue to re-roll the third kind. The number of required rolls is $Geom(\tfrac{1}{6})$ (expectation of additional rolls is $6$).
If we got three different results ($Y=3$ w.p. $\tfrac{20}{36}$) then you reroll all or just two (no matter which ones), so the process repeated from this point onward.
By the law of complete expectation (the one represent the first role, the other term is the expected additional number of rolls till three of a kind):
$$E(X)=E(E(X\vert Y))=1+\tfrac{15\cdot 6 + 20 \cdot E(X)}{36}$$
Solving this leads to $E(X)=\tfrac{63}{8}=7.875$