A167821 a(n) is the number of n-tosses having a run of 3 or more heads or a run of 3 or more tails for a fair coin (i.e., probability is a(n)/2^n).
0, 0, 2, 6, 16, 38, 86, 188, 402, 846, 1760, 3630, 7438, 15164, 30794, 62342, 125904, 253782, 510758, 1026684, 2061730, 4136990, 8295872, 16627166, 33311646, 66716028, 133582106, 267406998, 535206832, 1071049286, 2143127030, 4287918140, 8578528818
Offset: 1
Links
- G. C. Greubel, Table of n, a(n) for n = 1..1000
- Index entries for linear recurrences with constant coefficients, signature (3, -1, -2).
Programs
-
Magma
[2^n-2*Fibonacci(n+1): n in [1..40]]; // Vincenzo Librandi, Jun 28 2016
-
Mathematica
CoefficientList[Series[(2 x^2)/(1 - 3 x + x^2 + 2 x^3), {x, 0, 30}], x] Table[2^n - 2*Fibonacci[n + 1], {n, 1, 31}] LinearRecurrence[{3, -1, -2}, {0, 0, 2}, 50] (* G. C. Greubel, Jun 27 2016 *)
Formula
G.f.: (2 x^2)/(1 - 3 x + x^2 + 2 x^3);
a(n) = 2^n - 2*Fibonacci(n+1).
a(n) = 3*a(n-1) - a(n-2) - 2*a(n-3). - G. C. Greubel, Jun 27 2016
Comments