%I #26 Feb 04 2024 18:18:11
%S 1,1,1,7,10,13,19,25,34,40,49,61,70,82,94,109,124,136,154,172,190,208,
%T 226,250,271,292,316,340,367,391,418,448,475,505,535,568,601,631,667,
%U 703,739,775,811,853,892,931,973,1015,1060,1102,1147,1195,1240
%N Number of (w,x,y) with all terms in {0,...,n} and range=average.
%C For a guide to related sequences, see A212959.
%H <a href="/index/Rec#order_09">Index entries for linear recurrences with constant coefficients</a>, signature (2,-2,2,-1,1,-2,2,-2,1).
%F a(n) = 2*a(n-1) - 2*a(n-2) + 2*a(n-3) - a(n-4) + a(n-5) - 2*a(n-6) + 2*a(n-7) - 2*a(n-8) + a(n-9).
%F G.f.: (1 - x + x^2 + 5*x^3 - 3*x^4 + 5*x^5 + x^6 - x^7 + x^8 )/(1 - 2*x + 2*x^2 - 2*x^3 + x^4 - x^5 + 2*x^6 - 2*x^7 + 2*x^8 - x^9).
%F From _Michael Somos_, Jan 25 2024: (Start)
%F a(n) = a(-1-n) for all n in Z.
%F G.f.: (1 + x)*(1 - x + x^2 + 5*x^3 - 3*x^4 + 5*x^5 + x^6 - x^7 + x^8))/((1 - x)*(1 - x^4)*(1 - x^5)). (End)
%F For n > 2, a(n) = 3 * A368482(n+3) + 4. - _Helmut Ruhland_, Jan 31 2024
%e a(3)=7 counts these (w,x,y): (0,0,0) and the six permutations of (1,2,3).
%e G.f. = 1 + x + x^2 + 7*x^3 + 10*x^4 + 13*x^5 + 19*x^6 + 25*x^7 + 34*x^8 + ... - _Michael Somos_, Jan 25 2024
%t t = Compile[{{n, _Integer}}, Module[{s = 0},
%t (Do[If[Max[w, x, y] - Min[w, x, y] == (w + x + y)/3, s = s + 1],
%t {w, 0, n}, {x, 0, n}, {y, 0, n}]; s)]];
%t m = Map[t[#] &, Range[0, 60]] (* A212979 *)
%t a[ n_] := If[n<0, a[-1-n], Sum[ Boole[Max[t] - Min[t] == Mean[t]], {t, Tuples[Range[0, n], 3]}]]; (* _Michael Somos_, Jan 25 2024 *)
%t a[ n_] := (9*(n^2+n) + 6*{10, 7, 1, 12, 10, 5, 7, 6, 12, 5}[[1 + Min[Mod[n, 20], Mod[-1-n, 20]]]])/20 - 2; (* _Michael Somos_, Jan 25 2024 *)
%o (PARI) {a(n) = (9*(n^2+n) + 6*[10, 7, 1, 12, 10, 5, 7, 6, 12, 5][1 + min(n%20, (-1-n)%20)])/20 - 2}; /* _Michael Somos_, Jan 25 2024 */
%Y Cf. A212959, A368482.
%K nonn,easy
%O 0,4
%A _Clark Kimberling_, Jun 03 2012
|