Statistics of Coin-Toss Patterns II
This is a follow-up to my first coint toss post a few days ago. I was surprised at the size of the difference between the average tosses for various patterns of the same length. For example, for the patterns THT vs THH, the average number of coin tosses to achieve the patterns differed by 2 tosses.
In my last post, I argued that the difference can be understood by looking at the number of permutations of n coin tosses without the target pattern. Below, I make this very explicit by calculating the fraction of possible coin toss permutations without the pattern over the total number of permutations.
For low numbers of coin tosses, the differences are small (the are equal up to 4 tosses for the THT and THH example; 5 for the example patterns HT and HH. In the calculation of average value of n, the terms are multiplied by ) The fraction of permutations of coin tosses without THT and THH are compared in the plot below. The corresponding data is in the table below.
without THT (red) and THH (blue).
I extended the code a little bit more to make this calculation. In Python script available in previous last post, I used a designed counting scheme for the series sum calculation. In this case, I extended the class to count the permutations without the pattern without ensuring the last len(pattern) terms equal the pattern (i.e. I just counted permutations this time). You can get the update here.
|Tosses||Total Permulations||Coin Toss Permutations WO Pattern (THT)||fraction||Coin Toss Permutations WO Pattern (THH)||fraction|