login
A212677
Number of (w,x,y,z) with all terms in {1,...,n} and w+y=|x-y|+|y-z|.
2
0, 0, 1, 7, 21, 46, 86, 144, 223, 327, 459, 622, 820, 1056, 1333, 1655, 2025, 2446, 2922, 3456, 4051, 4711, 5439, 6238, 7112, 8064, 9097, 10215, 11421, 12718, 14110, 15600, 17191, 18887, 20691, 22606, 24636, 26784, 29053, 31447, 33969
OFFSET
0,4
COMMENTS
For a guide to related sequences, see A211795.
FORMULA
a(n)=3*a(n-1)-3*a(n-2)+2*a(n-3)-3*a(n-4)+3*a(n-5)-a(n-6).
G.f.: (x^2 + 4*x^3 + 3*x^4 + 2*x^5)/(1 - 3*x + 3* x^2 - 2*x^3 + 3*x^4 - 3*x^5 + x^6)
MATHEMATICA
t = Compile[{{n, _Integer}}, Module[{s = 0},
(Do[If[w + 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]] (* A212677 *)
LinearRecurrence[{3, -3, 2, -3, 3, -1}, {0, 0, 1, 7, 21, 46}, 40]
CROSSREFS
Cf. A211795.
Sequence in context: A146411 A287431 A127736 * A146802 A147054 A146629
KEYWORD
nonn,easy
AUTHOR
Clark Kimberling, May 23 2012
STATUS
approved