What is the pmf of rolling a die until obtaining three consecutive $6$s?

I am trying to find the pmf of rolling a die until 3 consecutive 6s turn up. I am able to find the expected value using a tree diagram, but the pmf is not obvious to me.

Let A be the event of not rolling 6, and let B be the event of rolling a 6.

The geometric distribution does not work, because we could have any number of As and Bs (ex. ABBAAABBA…) until we reach BBB. But using a binomial doesn’t make sense to me either, because we don’t care how many As or Bs we have, we just care about the final 3 consecutive Bs.

Solutions Collecting From Web of "What is the pmf of rolling a die until obtaining three consecutive $6$s?"

The probabilities can be calculated recursively by $p(1)=p(2)=0$, $p(3)={1\over 216}$ and for $n>3$, $$p(n)={5\over 6}\,p(n-1)+{5\over 36}\,p(n-2)+{5\over 216}\,p(n-3).\tag1$$
I suspect that an explicit formula for $p(n)$ will be too complicated to be useful, but you may get useful information via the probability generating function $$G(s)={s^3\over 216-180s-30s^2-5s^3}.\tag 2$$ For example, differentiating $G$ and setting $s=1$ shows us that the expected number of throws until we see three 6s in a row is $258$.

We can look at this as a Markov process.

We have four states:

  1. Our last roll was not a 6;
  2. Our last roll was a 6, but the roll before that was not;
  3. Our last two rolls were 6s, but the one before those was not;
  4. Our last three rolls were 6s, in which case we are done.

Then we have the following transition matrix:
\frac{5}{6} & \frac{1}{6} & 0 & 0 \\
\frac{5}{6} & 0 & \frac{1}{6} & 0 \\
\frac{5}{6} & 0 & 0 & \frac{1}{6} \\
0 & 0 & 0 & 1

Then $A^n_{1,4}$ is the probability that we have achieved three 6s in a row by roll $n$.

And so, $p(n)=A^{n}_{1,4} – A^{n-1}_{1,4}$ yields the probability that we achieve three 6s on the $n$th roll, and not before.

So $p(0)=p(1)=p(2)=0$, $p(3)=\frac{1}{216}$, $p(4)=p(5)=p(6)=\frac{5}{1296}$, $p(7)=\frac{1075}{279936}$, $p(8)=\frac{6425}{1679616}$, etc.

Is there a closed form? If we look at $6^i p(i)$, we get the sequence that starts $$1,5,30,180,1075,6425,38400,229500,\dots . $$ This sequence is not in the OEIS, so it’s a fair bet there is no closed form.