OFFSET
0,5
COMMENTS
For a guide to related sequences, see A211795.
LINKS
Index entries for linear recurrences with constant coefficients, signature (1, 1, 1, -2, -2, 1, 1, 1, -1).
FORMULA
a(n)=a(n-1)+a(n-2)+a(n-3)-2*a(n-4)-2*a(n-5)+a(n-6)+a(n-7)+a(n-8)-a(n-9).
G.f.: (5*x^4 + 9*x^5 + 9*x^6 + 6*x^7 + 2*x^8)/(1 - x - x^2 - x^3 + 2*x^4 + 2*x^5 - x^6 - x^7 - x^8 + x^9)
MATHEMATICA
t = Compile[{{n, _Integer}}, Module[{s = 0},
(Do[If[w + x + y == Abs[x - y] + Abs[y - z], s = s + 1],
{w, 1, #}, {x, 1, #}, {y, 1, #}, {z, 1, #}] &[n]; s)]];
Map[t[#] &, Range[0, 40]] (* A212678 *)
LinearRecurrence[{1, 1, 1, -2, -2, 1, 1, 1, -1}, {0, 0, 0, 0, 5, 14, 28, 53, 87}, 40]
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Clark Kimberling, May 23 2012
STATUS
approved