OFFSET
1,2
LINKS
Colin Barker, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (3,-2,-1,1).
FORMULA
For n >= 2, a(n) = 2F(n-1)+2n-4, where F(n) is the n-th Fibonacci number.
From Colin Barker, Mar 20 2017: (Start)
G.f.: 2*x^2*(1 - x - x^3) / ((1 - x)^2*(1 - x - x^2)).
a(n) = 2*(-2+(2^(-1-n)*((1-sqrt(5))^n*(1+sqrt(5)) + (-1+sqrt(5))*(1+sqrt(5))^n)) / sqrt(5) + n) for n>1.
a(n) = 3*a(n-1) - 2*a(n-2) - a(n-3) + a(n-4) for n>4.
(End)
EXAMPLE
For n = 5, the 12 such strings are {00010,00011,00110,01011,01100,01110} and their binary complements.
MATHEMATICA
Rest@ CoefficientList[Series[2 x^2*(1 - x - x^3)/((1 - x)^2*(1 - x - x^2)), {x, 0, 43}], x] (* Michael De Vlieger, Mar 20 2017 *)
LinearRecurrence[{3, -2, -1, 1}, {0, 2, 4, 8, 12}, 50] (* Harvey P. Dale, Apr 07 2023 *)
PROG
(PARI) concat(0, Vec(2*x^2*(1 - x - x^3) / ((1 - x)^2*(1 - x - x^2)) + O(x^50))) \\ Colin Barker, Mar 20 2017
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Jeffrey Shallit, Mar 20 2017
STATUS
approved
