Sequences or Patterns.
as in a fair coin flip.
HH or HT or HTH. IF one keeps flipping a fair coin until a certain sequence (pattern) appears, how many flips, on average, will it take? The below worksheet can answer that question up to a 6 trial sequence.
This is NOT about a race between 2 or more sequences. Which 'pattern' will show up 1st? That can be found on the Penney-Ante Game page in this site.
example:
HH (Heads and then Heads) = 6 flips on average
HT (Heads and then Tails) = 4 flips on average
HTH ( Heads, Tails and heads) = 10 flips on average
The math behind this is concerned about overlap in the sequence. It is a simple concept to grasp once seen.
R code below Google sheet (section 1r.)
1r. R code for the mean wait time for a pattern.
example: pMeanWaitTime(c(1,0,1)) is the pattern 101 and p(1)=1/2 (by default)
Instead of using HH or HT or HTH, the code requires only 1s and 0s to be used. I use 1,1 for HH and 1,0 for HT and 1,0,1 for HTH
more call Instructions coming soon
Spreadsheet for calculating (showing HOW) the mean wait time for a pattern (binomial). Uses a leading number method. Value of H (p) can be changed. Not exactly as John Conways' algorithm but using the 'shift one toss to right' method to find the pattern overlap.