TITLE: How to calculate the probability of rolling 6 at least 5 times in a row, out of 50 tries?
QUESTION [13 upvotes]: 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?

REPLY [3 votes]: This problem can also be approached using a generating function as in this related answer.

Using A Generating Function
As Jack D'Aurizio notes, we can build up all possible strings where $6$ does not appear at least $5$ times with the $5$ atoms
$$
\underbrace{\square\vphantom{6}}_{\large 5x^{\vphantom{1}}},\underbrace{6\square}_{\large 5x^2},\underbrace{66\square}_{\large 5x^3},\underbrace{666\square}_{\large 5x^4},\underbrace{6666\square}_{\large 5x^5}
$$
The coefficient of $5$ represents the number of ways to fill the $\square$. Note that any sequence of length $50$ can be made in a unique way by putting together such atoms to a length of $51$ and removing the last $\square$. Therefore, in the sum
$$
\begin{align}
\sum_{k=0}^\infty5^k(x+x^2+x^3+x^4+x^5)^k
&=\frac1{1-5\frac{x-x^6}{1-x}}\\
&=\frac{1-x}{1-6x+5x^6}\tag{1}
\end{align}
$$
the coefficient of $x^{n+1}$ is $5$ times the number of ways to arrange $n$ numbers with no subsequence of $5$ sixes in a row.
The coefficient of $x^{51}$ is $4021435247555066377711342806458789062500$ and $6^{50}$ is $808281277464764060643139600456536293376$. Dividing their quotient by $5$ and subtracting from $1$, we get a probability of
$$
\frac{4109288018262124589373497083105433}{831565100272391008892118930510839808}\doteq0.0049416311686434034927\tag{2}
$$

Computing The Coefficients By Recursion
Computing the coefficients of generating function in $(1)$ can be tedious. I used Mathematica to compute $(2)$. However, there is a more manual-friendly way to compute the coefficients using recursion.
The denominator in $(1)$ tells us that the coefficients of the series should satisfy
$$
a_n=6a_{n-1}-5a_{n-6}\tag{3}
$$
where we compute the first $6$ terms by series division
$$
a_0=1,a_1=5,a_2=30,a_3=180,a_4=1080,a_5=6480\tag{4}
$$
Using this recursion, it is easier to compute
$$
a_{51}=4021435247555066377711342806458789062500\tag{5}
$$