A212691 Number of (w,x,y,z) with all terms in {1,...,n} and w+|x-y|<=|x-z|+|y-z|.
0, 0, 2, 8, 26, 50, 100, 154, 252, 348, 510, 660, 902, 1118, 1456, 1750, 2200, 2584, 3162, 3648, 4370, 4970, 5852, 6578, 7636, 8500, 9750, 10764, 12222, 13398, 15080, 16430, 18352, 19888, 22066, 23800, 26250, 28194, 30932, 33098, 36140
Offset: 0
Links
- Index entries for linear recurrences with constant coefficients, signature (1, 3, -3, -3, 3, 1, -1).
Crossrefs
Cf. A211795.
Programs
-
Mathematica
t = Compile[{{n, _Integer}}, Module[{s = 0}, (Do[If[w + Abs[x - y] == Abs[x - z] + Abs[y - z], s = s + 1], {w, 1, #}, {x, 1, #}, {y, 1, #}, {z, 1, #}] &[n]; s)]]; Map[t[#] &, Range[0, 40]] (* A212691 *) %/2 (* integers *) LinearRecurrence[{1, 3, -3, -3, 3, 1, -1}, {0, 0, 2, 8, 26, 50, 100}, 40]
Formula
a(n)=a(n-1)+3*a(n-2)-3*a(n-3)-3*a(n-4)+3*a(n-5)+a(n-6)-a(n-7).
G.f.: 2*x^2*(1+3*x+6*x^2+x^4+3*x^3) / ( (1+x)^3*(x-1)^4 )
a(n) = n*(n-1)*(14*n-7+3*(-1)^n)/24. - R. J. Mathar, Jul 01 2013
Comments