# (OT) mathematicians-discover-prime-conspiracy

Andrew Gallagher andrewg at andrewg.com
Fri Mar 18 14:26:07 CET 2016

```On 18/03/16 12:18, Peter Lebbing wrote:
>
> After over a million coin tosses, it takes 6 tosses on average until you
> see two heads in a row, but only 4 to see head-tail. Obviously, the
> script is attached. Supply the patterns on invocation, as shown above.
> Any number of patterns of any length are supported (I think). Well,
> strictly positive numbers and lengths :).
>
> Can someone point me in the direction of the solution to this
> counterintuitive probability theory result? Any of a common name for the
> property, a mathematical explanation or an intuitive explanation are
> much appreciated!

The intuitive result (that all sequences of N random equally-probable
events must have the same probability of happening first) holds if one
fixes the groupings of events in advance so that all possible sequences
are independent of each other ("mutual independence" being the most
important statistical precondition!). In this case, if the pairing of
coin tosses is always the odd-numbered toss followed by the
even-numbered toss, e.g:

TH HT HH TT HT HH TH HT

then for any *given* pair of tosses, the probability that it contains a
particular sequence is independent of any other *non-overlapping* pair
of tosses.

However, if one looks for a sequence of N events in a string without
specifying in advance which window into the string we are matching
against, then sequences of identical events will generally be less
likely than mixed ones. This is because we can choose after the fact
whether to consider an event the beginning of a new sequence or a
continuation of the previous one, and overlapping sequences of events
are not mutually independent.

An extreme example is the case of the ten-event sequences HHHHHHHHHH and
THHHHHHHHHH. Unless the first sequence of ten heads occurs at the very
beginning of the string of events (which is highly unlikely!), then the
sequence beginning with a single tails must *always* occur one event
earlier than the first sequence of ten-heads. But it could also have
occurred much earlier than ten-heads, if it had been followed by another
tail.

Alternatively, we could consider how we treat the sequence history after
a "success". Do we wipe the slate clean once we get ten heads and start
over? Or if the eleventh toss was another head, do we consider that a
second sequence of ten heads? If we can choose part-way through an
experiment when to stop, then that skews not only the order in which
events are seen, but also the probability that they will be seen at all.

The moral of the story is: outside the comfortable walls of mutual
independence, there be dragons. ;-)

A

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: OpenPGP digital signature
URL: </pipermail/attachments/20160318/262b85f1/attachment.sig>
```