Skip to content

Statistics of Coin-Toss Patterns II

April 10, 2008

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 \frac{1}{2^n}) 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.

 

THT vs THH Permutations
Fraction of total coin toss sequecne permutations
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
1 2 2 1.000 2 1.000
2 4 4 1.000 4 1.000
3 8 7 0.875 7 0.875
4 16 12 0.750 12 0.750
5 32 21 0.656 20 0.625
6 64 37 0.578 33 0.516
7 128 65 0.508 54 0.422
8 256 114 0.445 88 0.344
9 512 200 0.391 143 0.279
10 1,024 351 0.343 232 0.227
11 2,048 616 0.301 376 0.184
12 4,096 1,081 0.264 609 0.149
13 8,192 1,897 0.232 986 0.120
14 16,384 3,329 0.203 1,596 0.097
15 32,768 5,842 0.178 2,583 0.079
16 65,536 10,252 0.156 4,180 0.064
17 131,072 17,991 0.137 6,764 0.052
18 262,144 31,572 0.120 10,945 0.042
19 524,288 55,405 0.106 17,710 0.034
20
1,048,576
97,229 0.093 28,656 0.027
21 2,097,152 170,625 0.081 46,367 0.022
Advertisement
No comments yet

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: