I was recently thinking of a general formula for the following question: what is the expected number of flips of a coin until you have seen k consecutive heads? What if the coin is biased?
While the question itself has mostly been answered, I came across this answer for the fair coin case, and I am wondering why it does not work for the biased coin case.
Specifically, following the logic in the answer given, for a biased coin with probability $p$ of heads: let $E_n$ be the expected number of flips until the $n$ consecutive heads. After $E_{n-1}$ flips, we have two cases for the next flip:
(1) with probability $p$ we get heads, and have $E_{n-1}+1$ flips
(2) with probability $1-p$ we get tails, and have $E_{n-1} + 1 + E_{n}$ flips
This gives:
$$ E_n = p(E_{n-1}+1) + (1-p)(E_{n-1} + 1 + E_{n}) \\ E_n = pE_{n-1} + p + E_{n-1}+1+E_{n} - pE_{n-1}-p-pE_{n}\\ E_{n} = E_{n-1}+1+E_n-pE_n \\ \implies E_n =(\frac{1}{p})E_{n-1} + \frac{1}{p} \\ $$
Then define $f(n) = E_n + \frac{1}{p}$ with $f(0) = \frac{1}{p}$. $$ f(n) = \frac{1}{p}f(n-1) \\ \implies f(n) = \frac{1}{p^{n+1}} $$ So then $E_n = \frac{1}{p^{n+1}}-\frac{1}{p} = \frac{1}{p}(\frac{1}{p^n}-1)$
However, consider $p=0.25$. Then, according to the above for $n=1$, $E_1=12$ But by a geometric distribution, we clearly know that $E_1 = 4$. For $p=1/2$, this formula is correct, but for $p != 0.5$, this formula is incorrect (in the $p=0.25$ case, the formula is off by a factor of 3). Could someone explain why this is the case? Does anyone have any other intuitive explanations for the generalized formula?
Thank you