login
A212758
Number of (w,x,y,z) with all terms in {0,...,n} and w=[R/2], where R=max{w,x,y,z}-min{w,x,y,z} and [ ]=floor.
2
1, 8, 20, 57, 118, 172, 299, 468, 594, 865, 1196, 1424, 1893, 2440, 2800, 3521, 4338, 4860, 5887, 7028, 7742, 9129, 10648, 11584, 13385, 15336, 16524, 18793, 21230, 22700, 25491, 28468, 30250, 33617, 37188, 39312, 43309, 47528, 50024
OFFSET
0,2
COMMENTS
For a guide to related sequences, see A211795.
FORMULA
a(n)=a(n-1)+3*a(n-3)-3*a(n-4)-3*a(n-6)+3*a(n-7)+a(n-9)-a(n-10).
G.f.: ( 1+7*x+12*x^2+34*x^3+40*x^4+18*x^5+19*x^6+7*x^7 ) / ( (1+x+x^2)^3*(1-x)^4 ).
a(n) ~ 23*n^3/27. - Charles R Greathouse IV, May 30 2026
MATHEMATICA
t = Compile[{{n, _Integer}}, Module[{s = 0},
(Do[If[w == Floor[(Max[w, x, y, z] - Min[w, x, y, z])/2], s = s + 1],
{w, 0, n}, {x, 0, n}, {y, 0, n}, {z, 0, n}]; s)]];
Map[t[#] &, Range[0, 45]] (* A212758 *)
LinearRecurrence[{1, 0, 3, -3, 0, -3, 3, 0, 1, -1}, {1, 8, 20, 57, 118, 172, 299, 468, 594, 865}, 45]
PROG
(PARI) a(n)=my(q=n\3); 23*q^3+[24*q^2+9*q+1, 51*q^2+36*q+8, 66*q^2+63*q+20][n%3+1] \\ Charles R Greathouse IV, May 30 2026
CROSSREFS
Cf. A211795.
Sequence in context: A036835 A295933 A360222 * A179756 A238507 A101363
KEYWORD
nonn,easy
AUTHOR
Clark Kimberling, May 28 2012
STATUS
approved