%I #13 Feb 17 2024 14:04:35
%S 0,1,6,19,42,79,132,205,300,421,570,751,966,1219,1512,1849,2232,2665,
%T 3150,3691,4290,4951,5676,6469,7332,8269,9282,10375,11550,12811,14160,
%U 15601,17136,18769,20502,22339,24282,26335,28500,30781,33180
%N Number of (w,x,y,z) with all terms in {1,...,n} and |x-y|=n-w+|y-z|.
%C For a guide to related sequences, see A211795.
%C Also the number of (w,x,y) with all terms in {0,...,n-1} and |w-x|>=|x-y|, see A212959. _Clark Kimberling_, Jun 02 2012
%H <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (3,-2,-2,3,-1).
%F a(n) = 3*a(n-1)-2*a(n-2)-2*a(n-3)+3*a(n-4)-a(n-5).
%F a(n) + A212683(n) = n^3. _Clark Kimberling_, Jun 02 2012
%F G.f.: x*(1+3*x+3*x^2-x^3)/((1+x)*(1-x)^4). [_Bruno Berselli_, Jun 07 2012]
%F a(n) = (2*n*(n+2)*(2*n-1)-(-1)^n+1)/8. [_Bruno Berselli_, Jun 07 2012]
%t t = Compile[{{n, _Integer}}, Module[{s = 0},
%t (Do[If[Abs[x - y] == n - w + Abs[y - z], s = s + 1],
%t {w, 1, #}, {x, 1, #}, {y, 1, #}, {z, 1, #}] &[n]; s)]];
%t Map[t[#] &, Range[0, 40]] (* A212684 *)
%t LinearRecurrence[{3, -2, -2, 3, -1}, {0, 1, 6, 19, 42}, 41] (* _Bruno Berselli_, Jun 07 2012 *)
%o (Maxima) makelist(coeff(taylor(x*(1+3*x+3*x^2-x^3)/((1+x)*(1-x)^4), x, 0, n), x, n), n, 0, 40); /* _Bruno Berselli_, May 07 2012 */
%Y Cf. A211795.
%K nonn,easy
%O 0,3
%A _Clark Kimberling_, May 24 2012