login
A212678
Number of (w,x,y,z) with all terms in {1,...,n} and w+x+y=|x-y|+|y-z|.
2
0, 0, 0, 0, 5, 14, 28, 53, 87, 130, 191, 265, 353, 465, 595, 743, 922, 1123, 1347, 1608, 1896, 2211, 2570, 2960, 3382, 3854, 4362, 4906, 5507, 6148, 6830, 7575, 8365, 9200, 10105, 11059, 12063, 13143, 14277, 15465, 16736, 18065, 19453, 20930
OFFSET
0,5
COMMENTS
For a guide to related sequences, see A211795.
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
Cf. A211795.
Sequence in context: A024800 A005586 A197058 * A244100 A031333 A303706
KEYWORD
nonn,easy
AUTHOR
Clark Kimberling, May 23 2012
STATUS
approved