OFFSET
0,2
COMMENTS
For a guide to related sequences, see A211422.
LINKS
Colin Barker, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (2,0,-2,1).
FORMULA
a(n) = 2*a(n-1) - 2*a(n-3) + a(n-4) for n>4.
From Colin Barker, Dec 04 2017: (Start)
G.f.: 2*x*(1 + 6*x + 3*x^2 + 2*x^3) / ((1 - x)^3*(1 + x)).
a(n) = 6*n^2 - 6*n + 4 for n>0 and even.
a(n) = 6*n^2 - 6*n + 2 for n odd.
(End)
MATHEMATICA
t = Compile[{{u, _Integer}},
Module[{s = 0}, (Do[If[-1 <= 2 w + x + y <= 1,
s = s + 1], {w, #}, {x, #}, {y, #}] &[
Flatten[{Reverse[-#], #} &[Range[1, u]]]]; s)]];
Map[t[#] &, Range[0, 70]] (* A211620 *)
%/2 (* integers *)
FindLinearRecurrence[%]
(* Peter J. C. Moses, Apr 13 2012 *)
Join[{0}, LinearRecurrence[{2, 0, -2, 1}, {2, 16, 38, 76}, 42]] (* Ray Chandler, Aug 02 2015 *)
PROG
(PARI) concat(0, Vec(2*x*(1 + 6*x + 3*x^2 + 2*x^3) / ((1 - x)^3*(1 + x)) + O(x^40))) \\ Colin Barker, Dec 04 2017
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Clark Kimberling, Apr 16 2012
STATUS
approved