As seen in this question, André Nicolas provides a solution for 5 heads in a row.
Basically, for any sort of problem that relies on determining this sort of probability, if the chance of each event is 50/50, then no matter what the composition of values, the linear equation would be the same?
For example, in the case of flipping 5 coins, and wanting to find out how many flips are needed for 4 consecutive tails followed by a head, is the same form as trying to find how many flips for 5 heads?
specifically:
$$x=\frac{1}{2}(x+1)+\frac{1}{4}(x+2)+\frac{1}{8}(x+3)+\frac{1}{16}(x+4)+\frac{1}{32}(x+5)+\frac{1}{32}(5).$$
Where $\frac{1}{32}(x+5)$ denotes the last flips chance of landing a tails after 4 heads in a row (.5*.5*.5*.5*(P(tails))
If I was using an unfair coin in the same example as above (HHHHT) with a 60% chance to land on heads, would the equation be:
$$x=\frac{1}{2}(x+1)+\frac{1}{4}(x+2)+\frac{1}{8}(x+3)+\frac{1}{16}(x+4)+\frac{1}{40}(x+5)+\frac{1}{40}(5).$$
As landing two heads like you said would not set be back two flips, but only one? (Or do I need another state)
– Anon29 Apr 27 '13 at 00:35