# What's the expected number of coin tosses in order to get a sequence HHTTHH?

Assume you have a fair coin. What's the expected number of coin tosses in order to get a sequence HHTTHH? (H=head,T=tail).

I want to know if there is a general formula for this kinds of problems?

-
Do you want HHTHHH to appear as a subsequence anywhere in a long list of tosses, or do you do 6 tosse, and then restart the sequence? – Larry D'Anna Mar 24 '13 at 5:35
You will do a long list of tosses, as long as you get HHTTHH, you will stop, count on average how many times you need to toss in order to get HHTTHH. – nkhuyu Mar 24 '13 at 5:42
This has been asked on the site several times before and several methods to solve every similar problem have been detailed in answers. Did you look for them before asking? – Did Mar 24 '13 at 10:16

The answer is $70=2^{\color{red}{6}}+2^{\color{red}{2}}+2^{\color{red}{1}}$. The integers $6$, $2$ and $1$ are the lengthes of the prefixes of the word HHTTHH that are also its suffixes, here HHTTHH, HH and H.