login
Number of (w,x,y) with all terms in {0,...,n} and w = min(|w-x|, |x-y|, |y-w|).
2

%I #21 Feb 19 2024 11:42:40

%S 1,4,9,16,27,38,53,70,89,110,135,160,189,220,253,288,327,366,409,454,

%T 501,550,603,656,713,772,833,896,963,1030,1101,1174,1249,1326,1407,

%U 1488,1573,1660,1749,1840,1935,2030,2129,2230,2333,2438,2547,2656

%N Number of (w,x,y) with all terms in {0,...,n} and w = min(|w-x|, |x-y|, |y-w|).

%C For a guide to related sequences, see A212959.

%H <a href="/index/Rec#order_06">Index entries for linear recurrences with constant coefficients</a>, signature (1,1,0,-1,-1,1).

%F a(n) = a(n-1) + a(n-2) - a(n-4) - a(n-5) + a(n-6).

%F G.f.: (1 + 3*x + 4*x^2 + 3*x^3 + 3*x^4)/(1 - x - x^2 + x^4 + x^5 - x^6).

%F a(n) = (n+1)^3 - A213492(n).

%t t = Compile[{{n, _Integer}}, Module[{s = 0}, (Do[If[w == Min[Abs[w - x], Abs[x - y], Abs[y - w]], s = s + 1], {w, 0, n}, {x, 0, n}, {y, 0, n}]; s)]];

%t m = Map[t[#] &, Range[0, 60]]

%t (* or *)

%t LinearRecurrence[{1, 1, 0, -1, -1, 1}, {1, 4, 9, 16, 27, 38}, 60]

%t CoefficientList[Series[(1+3x+4x^2+3x^3+3x^4)/(1-x-x^2+x^4+x^5-x^6),{x,0,50}],x] (* _Harvey P. Dale_, Aug 11 2021 *)

%Y Cf. A212959, A213492.

%K nonn,easy

%O 0,2

%A _Clark Kimberling_, Jun 13 2012