How to calculate the probability of rolling 6 at least 5 times in a row, out of 50 tries? If I roll the dice 50 times, how do I calculate the chance that I will roll 6 at least 5 times in a row?
Why this problem is hard

*

*With 5 tries this would be easy: take $(1/6)$ to fifth power.

*With 6 tries this is manageable; take the probability of rolling 6 the first five times, add the probability of rolling 6 the last five times, then subtract the overlap (all six results are 6).

*Given two overlapping sets of 5 rolls, the probability that one is all 6's is not independent from the probability that the other is all 6's.

*In principle this could be continued, but inclusion-exclusion gets out of hand. There has to be a better way; what is it?


There is no straightforward formula for this probability. However it can be computed exactly (within numerical error). You can keep track of the vector of probabilities $\mathbf{p}_t$ that at time $t$ you are in state:


*

*you haven't already rolled 5 6s and at the present time have rolled 0 6s,

*you haven't already rolled 5 6s and at the present time have rolled 1 6s,

*you haven't already rolled 5 6s and at the present time have rolled 2 6s,

*you haven't already rolled 5 6s and at the present time have rolled 3 6s,

*you haven't already rolled 5 6s and at the present time have rolled 4 6s, or

*you have already rolled 5 6s.


There are thus 6 probabilities in the vector. And initially $\mathbf{p}_0 = [1, 0, 0, 0, 0, 0]^T$. The chance of transitioning from state 1 to state 2 is $1/6$ and similarly for other states upto state 5 to state 6. From states 1 to 5 the chance of transitioning back to state 1 is $5/6$. However once you have already rolled 5 6s you have always already rolled 5 6s so if you get to state 6 you stay in state 6. These probabilities can be specified in a transition matrix $X$:
$$ X = \left\{
\begin{array}{c|cccccc}
& S_1 & S_2 & S_3 & S_4 & S_5 & S_6  \\
\hline
S_1 & \frac56 & \frac56 & \frac56 & \frac56 &\frac56  & 0 \\ 
S_2 &  \frac16 &0 & 0 &0 & 0 & 0 \\
S_3 & 0 & \frac16 &0 &0 & 0 & 0 \\
S_4 & 0 & 0 &\frac16 &0 & 0 & 0 \\
S_5 & 0 & 0 &0 &\frac16 & 0 & 0 \\
S_6 & 0 & 0 & 0&0 &\frac16 & 1
\end{array}\right\}
$$
Probabilities for time $t+1$ can be computed from probabilities for time $t$ by applying the transition matrix:
$$ \mathbf{p}_{t+1} = X\mathbf{p}_t $$
Computing $\mathbf{p}_{50} = X^{50}\mathbf{p}_0$ gives the probability of observing at least 5 6s within 50 rolls to be 0.00494 (simulation gave 0.00493). As Hurkyl points out, for large numbers of rolls it can be worth using the square and multiply method for matrix exponentiation to maintain accuracy.
