OFFSET
0,4
COMMENTS
For a guide to related sequences, see A212959.
LINKS
Index entries for linear recurrences with constant coefficients, signature (2,-2,2,-1,1,-2,2,-2,1).
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).
From Michael Somos, Jan 25 2024: (Start)
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)
For n > 2, a(n) = 3 * A368482(n+3) + 4. - Helmut Ruhland, Jan 31 2024
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,changed
AUTHOR
Clark Kimberling, Jun 03 2012
STATUS
approved