OFFSET
1,3
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (1,2,-2,-1,1).
FORMULA
a(n) = a(n-1) + 2*a(n-2) - 2*a(n-3) - a(n-4) + a(n-5).
G.f.: (-1 - x^2 + 2 x^3 - 2 x^4)/((-1 + x)^3 (1 + x)^2).
MATHEMATICA
c[1] = 1; c[2] = 1;
c[n_] := If[OddQ[n], c[n - 2] + n, c[n - 1] - n + 2]
Table[c[n], {n, 1, 120}]
With[{nn=30}, Riffle[Range[nn]^2, Range[0, nn-1]^2+1]] (* or *) LinearRecurrence[{1, 2, -2, -1, 1}, {1, 1, 4, 2, 9}, 70] (* Harvey P. Dale, Mar 04 2026 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Clark Kimberling, May 24 2023
STATUS
approved
