|
|
A212979
|
|
Number of (w,x,y) with all terms in {0,...,n} and range=average.
|
|
3
|
|
|
1, 1, 1, 7, 10, 13, 19, 25, 34, 40, 49, 61, 70, 82, 94, 109, 124, 136, 154, 172, 190, 208, 226, 250, 271, 292, 316, 340, 367, 391, 418, 448, 475, 505, 535, 568, 601, 631, 667, 703, 739, 775, 811, 853, 892, 931, 973, 1015, 1060, 1102, 1147, 1195, 1240
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,4
|
|
COMMENTS
|
For a guide to related sequences, see A212959.
|
|
LINKS
|
|
|
FORMULA
|
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).
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).
a(n) = a(-1-n) for all n in Z.
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)
|
|
EXAMPLE
|
a(3)=7 counts these (w,x,y): (0,0,0) and the six permutations of (1,2,3).
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
|
|
MATHEMATICA
|
t = Compile[{{n, _Integer}}, Module[{s = 0},
(Do[If[Max[w, x, y] - Min[w, x, y] == (w + x + y)/3, s = s + 1],
{w, 0, n}, {x, 0, n}, {y, 0, n}]; s)]];
m = Map[t[#] &, Range[0, 60]] (* A212979 *)
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 *)
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 *)
|
|
PROG
|
(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 */
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|