A coin is flipped repeatedly. How long must you wait, on average, before you see a particular head-tail sequence of length five? Any fixed sequence has probability 1/25 = 1/32 of being observed in a given five flips, so the answer is 32, right? Not so fast. Overlapping causes problems. What is true is that in an infinite sequence of random flips, the average distance between one occurrence and the next of any fixed sequence is 32. But suppose the sequence is HHHHH. Such an occurrence would provide a huge "head start" (sorry) to the next occurrence. If the next flip is a tail, you must start over, but if a head, a new occurrence has already taken place. If X is the average time needed to get HHHHH starting fresh, the average of 1+X and 1 is 32. Solving for X yields a startlingly high 62 flips. To reduce your expected dues to $32, you must pick a sequence whose occurrence gives no head start to the next occurrence. HHHTT is one of 10 sequences with this property.
You and your opponent choose different length-five head-tail sequences, with the first to occur determining the winner. If possible, decline the "privilege" of picking first; whatever the first chooser chooses, the second can do much better. Worst case: you pick HHHHH, your opponent picks THHHH, and you are dead meat unless the flips begin with five heads. In general, if you pick VWXYZ your opponent crushes you by picking UVWXY, with the right choice of U. If my calculations are correct, you can do no better than, say, HHTHT (one of the good choices in Puzzle 1). Even then, your opponent counters with HHHTH, winning two times out of three. Does it bother you that your opponent has a big advantage, even though the average waiting time for your sequence is less?
You had to decide whether to risk $1 to win $19 by flipping exactly 50 heads in 100 flips. How likely is flipping 50 heads on the nose? A good estimate for flipping precisely n heads in 2n flips is 1/√(πn/2). Sheesh. What does π have to do with it? Anyway, with our modest numbers, a computer does the exact calculation easily; the number of ways to flip exactly 50 heads is "100 choose 50," or 100!/(50!)2, so the total number of outcomes for 100 flips is 2100. Dividing the first by the second yields approximately 8%, which exceeds 1/20, so it is indeed a good betassuming it was not made with your bottom dollar.
All readers are encouraged to submit prospective puzzles for future columns to [email protected].
©2013 ACM 0001-0782/13/12
Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and full citation on the first page. Copyright for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, to republish, to post on servers, or to redistribute to lists, requires prior specific permission and/or fee. Request permission to publish from [email protected] or fax (212) 869-0481.
The Digital Library is published by the Association for Computing Machinery. Copyright © 2013 ACM, Inc.
There are actually 12, not 10 sequences of length 5 with the property that the expected number of coin flips is 32 before the sequence appears first.
Actually, one can do better than a 0.33333 (1 in 3) chance of winning if they have to go first, with the winning sequence being the first one to occur. A best first choice is HTTHH; then, the best your adversary can do is choose THTTH, for a probability of success for you of 0.34615, so you win more often than 1 out of 3.
Displaying all 2 comments