A212677 Number of (w,x,y,z) with all terms in {1,...,n} and w+y=|x-y|+|y-z|.
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
Links
- Index entries for linear recurrences with constant coefficients, signature (3, -3, 2, -3, 3, -1).
Crossrefs
Cf. A211795.
Programs
-
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]
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)
Comments