%I #28 Oct 14 2018 11:38:02
%S 0,0,0,1,2,4,8,14,25,45,80,142,253,450,800,1423,2531,4501,8005,14237,
%T 25320,45031,80087,142433,253314,450514,801230,1424971,2534282,
%U 4507169,8015908,14256129,25354235,45091990,80195185,142625502,253656548
%N Number of sequences of n coin flips that win on the last flip, if the sequence of flips ends with (0,0,1,1).
%C If the sequence ends with (1,1,1,1) Kain wins.
%C Kain(n)=A199926(n). Winsum(n)=A199594(n).
%C Win probability of Abel = sum(a(n)/2^n) = 3/4.
%C Win probability of Kain = sum(Kain(n)/2^n)=1/4.
%C Mean length of the game = sum(n*Winsum(n)/2^n)=12.
%D A. Engel, Wahrscheinlichkeit und Statistik, Band 2, Klett, 1978, pages 25-26.
%H <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (1,1,1,0,-1).
%F a(n) = a(n-1)+a(n-2)+a(n-3)-a(n-5) for n>7.
%F a(n) = 2*a(n-1)-a(n-4)-a(n-5)+a(n-6) for n>8.
%F G.f.: x^4*(1+x)*(1+x^2)/(1-x-x^2-x^3+x^5).
%F a(n) = A164388(n-4) for n > 3. - _Georg Fischer_, Oct 14 2018
%e For n=6 the a(6)=4 solutions are (0,0,0,0,1,1),(1,0,0,0,1,1),(0,1,0,0,1,1),(1,1,0,0,1,1).
%p a(1):=0: a(2):=0: a(3):=0: a(4):=1: a(5):=2:
%p a(6):=4: a(7):=8: pot:=2^3: pa:=0:
%p for n from 4 to 7 do
%p pot:=2*pot:
%p pa:=pa+a(n)/pot:
%p end do:
%p for n from 8 to 100 do
%p pot:=2*pot:
%p a(n):=a(n-1)+a(n-2)+a(n-3)-a(n-5):
%p pa:=pa+a(n)/pot:
%p end do:
%p printf("%10.5f",pa):
%p seq(a(n), n=1..100);
%t LinearRecurrence[{1,1,1,0,-1},{0,0,0,1,2,4,8},40] (* _Harvey P. Dale_, Jul 11 2018 *)
%Y Cf. A164388, A199594, A199926.
%K nonn
%O 1,5
%A _Paul Weisenhorn_, Nov 12 2011