A212904 Number of (w,x,y,z) with all terms in {0,...,n} and |w-x|+|x-y+|y-z|=n.
1, 6, 24, 58, 118, 202, 324, 478, 682, 926, 1232, 1586, 2014, 2498, 3068, 3702, 4434, 5238, 6152, 7146, 8262, 9466, 10804, 12238, 13818, 15502, 17344, 19298, 21422, 23666, 26092, 28646, 31394, 34278, 37368, 40602, 44054, 47658, 51492
Offset: 0
Links
- Index entries for linear recurrences with constant coefficients, signature (2,1,-4,1,2,-1).
Crossrefs
Cf. A211795.
Programs
-
Mathematica
t = Compile[{{n, _Integer}}, Module[{s = 0}, (Do[If[Abs[w - x] + Abs[x - y] + Abs[y - z] == n, s = s + 1], {w, 0, n}, {x, 0, n}, {y, 0, n}, {z, 0, n}]; s)]]; m = Map[t[#] &, Range[0, 40]] (* A212904 *)
Formula
a(n) = 2*a(n-1)+a(n-2)-4*a(n-3)+a(n-4)+2*a(n-5)-a(n-6) for n>=1.
G.f.: f(x)/g(x), where f(x)=1 + 4*x + 11*x^2 + 8*x^3 + x^4 - 4*x^5 - x^6 and g(x)=((1-x)^4)*(1+x)^2.
Comments