OFFSET
0,5
LINKS
Colin Barker, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (4,-4,-1,2).
FORMULA
a(n) = 2*A232580(n-1) for n>0.
G.f.: 2*x^4/(1 - 4*x + 4*x^2 + x^3 - 2*x^4).
From Colin Barker, Nov 03 2016: (Start)
a(n) = 2^(-n)*(5*2^n*(2+2^n)+(1-sqrt(5))^n*(-5+3*sqrt(5))-(1+sqrt(5))^n*(5+3*sqrt(5)))/5 for n>0.
a(n) = 4*a(n-1)-4*a(n-2)-a(n-3)+2*a(n-4) for n>4.
(End)
EXAMPLE
a(5) = 8 because we have:
1: {0, 0, 0, 1, 1},
2: {0, 0, 1, 1, 0},
3: {0, 0, 1, 1, 1},
4: {0, 1, 1, 0, 0},
5: {1, 0, 0, 1, 1},
6: {1, 1, 0, 0, 0},
7: {1, 1, 0, 0, 1},
8: {1, 1, 1, 0, 0}.
MATHEMATICA
nn = 25; a = (x + x^2)/(1 - x^2); b = 1/(1 - 2x); c = 1/(1 - x - x^2); CoefficientList[Series[2x^3 a b c, {x, 0, nn}], x]
(* or *)
Table[Length[Select[Tuples[{0, 1}, n], MatchQ[#, {___, 1, 1, ___}] && MatchQ[#, {___, 0, 0, ___}] &]], {n, 0, 15}]
Join[{0}, LinearRecurrence[{4, -4, -1, 2}, {0, 0, 0, 2}, 40]] (* Vincenzo Librandi, Dec 28 2018 *)
PROG
(PARI) concat([0, 0, 0, 0], Vec(2*x^4/(1-4*x+4*x^2+x^3-2*x^4)+O(x^66))) \\ Joerg Arndt, Jan 04 2014
(Magma) I:=[0, 0, 0, 0, 2]; [n le 5 select I[n] else 4*Self(n-1)-4*Self(n-2)-Self(n-3)+2*Self(n-4): n in [1..40]]; // Vincenzo Librandi, Dec 28 2018
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Geoffrey Critzer, Jan 01 2014
STATUS
approved