I want to find the expected number of coin tosses to get $N$ heads in a row, where $p$ is the probability of getting a head in a single toss.
Let $F(N)$ be the expected number of tosses to get $N$ heads consecutively, so
$$F(N) = 1 + p F(N-1) + (1-p) F(N)$$
which gives
$$F(N) = 1/p + F(N-1)$$
With base condition : $F(1) = 1 + 1/p$
My logic is as follows:
if we get a head, in current toss we need to get N-1 more heads consecutively, but if we get a tail, we have to start over
This is what I thought, but is not correct. Can you please help me?