Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|cite|improve this question
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
up vote 5 down vote accepted

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.

For more details, see some previous posts on the site about this exact model, or the book DNA, Words and Models by Robin, Rodolphe, and Schbath (2005), or the survey Enumeration of strings (1985) by A. Odlyzko (see section 4, citing the paper A combinatorial identity and its application to the problem concerning the first occurrences of a rare event (1966) by A. D. Solov’ev).

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.