OFFSET
1,3
COMMENTS
The AGM transform {AGM(n): n >= 1} is a measure of the difference between the arithmetic mean A(n) = S(n)/n and the geometric mean G(n) = P(n)^(1/n) of a sequence {a(n): n >= 1}, where S(n) = a(1)+...+a(n), P(n) = a(1)*...*a(n). It is given by AGM(n) = S(n)^n - n^n*P(n).
For odd n, these terms appear to be divisible by n^n; for even n, by (n/2)^n. Additional reductions may be possible. For example, with n = 7, 11, 15, 19, ..., 59, the terms are also divisible by these powers of two: 4, 8, 11, 16, 19, 23, 26, 32, 35, 39, 42, 47, 50, 54. - Hans Havermann, Jan 24 2024
Since a(n) = n^n*(((n+1)/2)^n-n!) = (n(n+1)/2)^n-n^n*n!, a(n) is divisible by n^n for odd n and divisible by (n/2)^n for even n. - Chai Wah Wu, Jan 25 2024
LINKS
Paolo Xausa, Table of n, a(n) for n = 1..220
MAPLE
AGM := proc(f, M) local b, n, S, P, i, t; b:=[];
for n from 1 to M do
S:=add(f(i), i=1..n); P:=mul(f(i), i=1..n); t:=S^n-n^n*P;
b:=[op(b), t];
od:
b;
end;
fid:=proc(n) n; end; # the identity map
AGM(fid, 20);
MATHEMATICA
A368366[n_] := n^n (((n + 1)/2)^n - n!);
Array[A368366, 10] (* Paolo Xausa, Jan 29 2024 *)
PROG
(PARI) a368366(n) = {my(v=vector(n, i, i)); vecsum(v)^n - n^n*vecprod(v)}; \\ Hugo Pfoertner, Jan 24 2024
(Python)
from itertools import count, islice
def AGM(g): # generator of AGM transform of sequence given by generator g
S, P = 0, 1
for n, an in enumerate(g, 1):
S += an
P *= an
yield S**n-n**n*P
print(list(islice(AGM(count(1)), 15))) # Michael S. Branicky, Jan 24 2024
(Python)
from math import factorial
def A368366(n): return ((m:=n**n)*(n+1)**n>>n)-m*factorial(n) # Chai Wah Wu, Jan 25 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Jan 24 2024
STATUS
approved