Let
Eₙ
be the expected number of tosses required to obtain
n consecutive heads.
with
Solving the recurrence gives
For three heads:
The important difficulty is that a tail can destroy the progress toward HHH.
For example:
HH + T → HHT
↑
progress resets
Therefore HHH takes considerably longer than the naive
2³ = 8 tosses.
THH behaves differently because it has no non-empty self-overlap.
| Prefix | Suffix | Match? |
|---|---|---|
| T | H | No |
| TH | HH | No |
For a length-3 pattern with no self-overlap, the expected waiting time is simply
HHH and THH each have probability
1/8
of appearing in any particular block of three tosses.
But their expected waiting times are different:
The difference comes from pattern overlap.
Now suppose we continually toss a fair coin until either HHH or THH appears.
The key observation is to think about the first occurrence of HH.
Then we have just formed THH.
For HHH to beat THH, the sequence must begin:
Its probability is
Therefore:
Penney's game has two players:
Suppose Player 1 chooses
A strong optimal response for Player 2 is
The rule is not generally “take Player 1's last two symbols and prefix their opposite.”
The usual construction is:
Player 1 chooses:
The second symbol is H, whose opposite is T.
The first two symbols are HH.
Therefore Player 2 chooses:
The patterns overlap asymmetrically.
Whenever HHH is about to occur, the sequence often creates THH first.
... T H H H
└───┘
THH
└───┘
HHH
THH therefore steals many of the paths that would otherwise eventually produce HHH.
Choose Player 1's pattern. The optimal response for Player 2 is generated automatically.
| Question | Think About |
|---|---|
| Expected waiting time | Pattern self-overlap |
| Two patterns racing | Useful suffix / state transitions |
| Penney's game | opposite(second) + first two symbols |