cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A059943 Toss a fair coin and calculate the expected time until the n-th possible finite sequence of Heads and Tails first appears (ordered by length of sequence and alphabetical order so H, T, HH, HT, TH, TT, HHH, etc.).

This page as a plain text file.
%I A059943 #22 Dec 20 2014 03:35:55
%S A059943 2,2,6,4,4,6,14,8,10,8,8,10,8,14,30,16,18,16,18,20,18,16,16,18,20,18,
%T A059943 16,18,16,30,62,32,34,32,38,32,34,32,34,36,42,32,34,36,34,32,32,34,36,
%U A059943 34,32,42,36,34,32,34,32,38,32,34,32,62,126,64,66,64,70,64,66,64,70,72
%N A059943 Toss a fair coin and calculate the expected time until the n-th possible finite sequence of Heads and Tails first appears (ordered by length of sequence and alphabetical order so H, T, HH, HT, TH, TT, HHH, etc.).
%C A059943 Note the apparent paradox: HHHHHH, HTHTHT and HHHFFF are all equally likely to appear in six tosses of the coin (1/64) and in a long sequence each is expected to appear as a subsequence roughly as many times as the others, but the expected time for HHHHHH to first appear (126) is almost twice as long as for HHHFFF (64), with HTHTHT between the two (84). This is related to the fact that in a sequence of, say, 8 successive tosses, HHHHHH could appear as a subsequence 3 times simultaneously, HTHTHT twice but HHHTTT only once.
%D A059943 M. Gardner, Chapter 5 in Time Travel and Other Mathematical Bewilderments, W. H. Freeman, 1988, pp. 63-67.
%D A059943 Michael Hochster in sci.math and sci.stat.math quoting from Stochastic Processes by Sheldon Ross.
%H A059943 Reinhard Zumkeller, <a href="/A059943/b059943.txt">Table of n, a(n) for n = 1..10000</a>
%F A059943 a(n) = 2*A059942(n). For the n-th sequence S (e.g., the 35th is HHTHH), create the set X consisting of subsequences of S which appear both at the beginning and end of S (e.g., X={H, HH, HHTHH}), then a(n) = sum_x(2^length(x)|x is in X) (e.g., a(35)=2^1+2^2+2^5=38).
%e A059943 a(35)=38 since the expected time from xxxHHTH to completion of xxxHHTHH is 20, from xxxHHT to completion is 30, from xxxHH to completion is 32, from xxxH to completion is 36 and from xxx to completion is 38 (xxx is an earlier subsequence, perhaps empty, which cannot contribute to completion).
%t A059943 a[n_] := (id = Drop[ IntegerDigits[n+1, 2], 1]+1; an={}; Do[PrependTo[an, If[Take[id, k] == Take[id, -k], 1, 0]], {k, 1, Length[id]}]; 2*FromDigits[an, 2]); Table[a[n], {n, 1, 72}] (* _Jean-François Alcover_, Nov 21 2011 *)
%o A059943 (Haskell)
%o A059943 a059943 = (* 2) . a059942  -- _Reinhard Zumkeller_, Apr 03 2014
%Y A059943 Cf. A007931, A059941, A059942.
%K A059943 nice,nonn
%O A059943 1,1
%A A059943 _Henry Bottomley_, Feb 14 2001