OFFSET
1,2
COMMENTS
Number of wins in Penney's game if the two players start HHT and TTT and HHT beats TTT.
HHT beats TTT 70% of the time. - Geoffrey Critzer, Mar 01 2014
LINKS
G. C. Greubel, Table of n, a(n) for n = 1..1000
Wikipedia, Penney's game
Index entries for linear recurrences with constant coefficients, signature (1,1,0,-1).
FORMULA
a(n) = A164315(n-1). - Alois P. Heinz, Oct 12 2017
EXAMPLE
a(n) enumerates length n+2 sequences on {H,T} that end in HHT but do not contain the contiguous subsequence TTT.
a(3)=4 because we have: TTHHT, THHHT, HTHHT, HHHHT.
a(4)=6 because we have: TTHHHT, THTHHT, THHHHT, HTTHHT, HTHHHT, HHHHHT. - Geoffrey Critzer, Mar 01 2014
MAPLE
A171861 := proc(n) option remember; if n <=4 then op(n, [1, 2, 4, 6]); else procname(n-1)+procname(n-2)-procname(n-4) ; end if; end proc:
MATHEMATICA
nn=44; CoefficientList[Series[x(1+x+x^2)/(1-x-x^2+x^4), {x, 0, nn}], x] (* Geoffrey Critzer, Mar 01 2014 *)
PROG
(PARI) a(n)=([0, 1, 0, 0; 0, 0, 1, 0; 0, 0, 0, 1; -1, 0, 1, 1]^(n-1)*[1; 2; 4; 6])[1, 1] \\ Charles R Greathouse IV, Oct 03 2016
CROSSREFS
Related sequences are A000045 (HHH beats HHT, HTT beats TTH), A006498 (HHH beats HTH), A023434 (HHH beats HTT), A000930 (HHH beats THT, HTH beats HHT), A000931 (HHH beats TTH), A077868 (HHT beats HTH), A002620 (HHT beats HTT), A000012 (HHT beats THH), A004277 (HHT beats THT), A070550 (HTH beats HHH), A000027 (HTH beats HTT), A097333 (HTH beats THH), A040000 (HTH beats TTH), A068921 (HTH beats TTT), A054405 (HTT beats HHH), A008619 (HTT beats HHT), A038718 (HTT beats THT), A128588 (HTT beats TTT).
Cf. A164315 (essentially the same sequence).
KEYWORD
easy,nonn
AUTHOR
Ed Pegg Jr, Oct 16 2010
STATUS
approved