OFFSET
1,2
LINKS
Colin Barker, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (0,2,0,-1).
FORMULA
From Colin Barker, Mar 19 2020: (Start)
G.f.: x^2*(2 + 3*x + 4*x^2 - x^3 - 2*x^4) / ((1 - x)^2*(1 + x)^2).
a(n) = 2*a(n-2) - a(n-4) for n>6.
a(n) = (3 + (-1)^n)*n / 2 for n>2.
(End)
MATHEMATICA
Accumulate@ Nest[Append[#, Block[{k = 1, s = 1}, While[Nand[FreeQ[#, s k], And[IntegerQ@ Mean@ #, Total@ # != 0] &@ Append[#, s k]], If[s == 1, s = -1, k++; s = 1]]; s k]] &, {0}, 59] (* Michael De Vlieger, Dec 12 2017 *)
PROG
(PARI) concat(0, Vec(x^2*(2 + 3*x + 4*x^2 - x^3 - 2*x^4) / ((1 - x)^2*(1 + x)^2) + O(x^80))) \\ Colin Barker, Mar 19 2020
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Enrique Navarrete, Dec 04 2017
STATUS
approved