# Probability of consecutive dice rolls

This is probably quite a simple question but here I go..
Suppose you are going to roll a six-sided (fair) die N times, what is the probability that you will get at least one set of three consecutive numbers in a row?
Hopefully that's clear enough but as an example, in nine rolls you may get:
1, 4, 2, 6, 4, 4, 4, 4, 3
With the 4s making two sets of consecutive rolls.
Thanks!

Let $T$ denote the first time when this happens and, for every $|s|\leqslant1$ and $k$ in $\{0,1,2\}$, $u_k(s)=E_k[s^T]$ where $k$ is the number of identical results just produced. One is asking for $P_0[T\leqslant N]$. A one-step Markov conditioning yields the usual linear system $u_0=su_1$, $u_1=s\left(\frac16u_2+\frac56u_1\right)$ and $u_2=s\left(\frac16+\frac56u_1\right)$.
Solving this yields $u_0(s)=\frac{s^3}{36-30s-5s^2}$. There exists two positive real numbers $a$ and $b$ such that $36-30s-5s^2=36(1-as)(1+bs)$, thus $u_0(s)=\frac1{36}\frac1{a+b}s^3\left(\frac{a}{1-as}+\frac{b}{1+bs}\right)$ and, for every $n\geqslant1$, $P_0[T=n+2]=\frac1{36}\frac1{a+b}(a^{n}-(-1)^nb^{n})$. The value of $P_0[T\leqslant N]$ follows.
Numerically, $a=\frac1{12}(5+3\sqrt5)=0.97568$, $b=\frac1{12}(-5+3\sqrt5)=0.14235$, for every $n\geqslant1$, $P_0[T=n+2]=\frac1{18\sqrt{5}}(a^{n}-(-1)^nb^{n})$, and, when $n\to\infty$, $$P_0[T=n]\sim\frac{7-3\sqrt5}{5\sqrt5}a^n,\qquad P_0[T\geqslant n]\sim\frac{12}{5\sqrt5}a^n.$$
The number of $$N$$-tuples over $$\{1,2,3,4,5,6\}$$ with no runs of 3 or more consecutive values the same is $$6\sum_{j} 5^{N-j-1}{N-j\choose j}.\tag1$$ The probability of no such "triple" runs is $$(1)$$ divided by $$6^N,$$ and subtracting this from $$1$$ gives you what you want.
• This sums over the number $j$ of pairs of identical values, whose position can be chosen in $\binom{N-j}j$ ways in the $N-j$ runs ($j$ pairs and $N-2j$ singletons); the first run can have $6$ different values and each subsequent run $5$. – joriki Mar 28 at 18:13