cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A368366 AGM transform of positive integers (see Comments for definition).

This page as a plain text file.
%I A368366 #41 Jan 29 2024 09:14:54
%S A368366 0,1,54,3856,384375,52173801,9342271792,2144652558336,616093495529805,
%T A368366 217007162119140625,92121505246667356416,46444033776765696086016,
%U A368366 27459259766085858672714571,18830590227539089561714381425,14834398958231516437500000000000
%N A368366 AGM transform of positive integers (see Comments for definition).
%C A368366 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).
%C A368366 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
%C A368366 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
%H A368366 Paolo Xausa, <a href="/A368366/b368366.txt">Table of n, a(n) for n = 1..220</a>
%p A368366 AGM := proc(f,M) local b,n,S,P,i,t; b:=[];
%p A368366 for n from 1 to M do
%p A368366 S:=add(f(i),i=1..n); P:=mul(f(i),i=1..n); t:=S^n-n^n*P;
%p A368366 b:=[op(b),t];
%p A368366 od:
%p A368366 b;
%p A368366 end;
%p A368366 fid:=proc(n) n; end; # the identity map
%p A368366 AGM(fid,20);
%t A368366 A368366[n_] := n^n (((n + 1)/2)^n - n!);
%t A368366 Array[A368366, 10] (* _Paolo Xausa_, Jan 29 2024 *)
%o A368366 (PARI) a368366(n) = {my(v=vector(n,i,i)); vecsum(v)^n - n^n*vecprod(v)}; \\ _Hugo Pfoertner_, Jan 24 2024
%o A368366 (Python)
%o A368366 from itertools import count, islice
%o A368366 def AGM(g): # generator of AGM transform of sequence given by generator g
%o A368366     S, P = 0, 1
%o A368366     for n, an in enumerate(g, 1):
%o A368366         S += an
%o A368366         P *= an
%o A368366         yield S**n-n**n*P
%o A368366 print(list(islice(AGM(count(1)), 15))) # _Michael S. Branicky_, Jan 24 2024
%o A368366 (Python)
%o A368366 from math import factorial
%o A368366 def A368366(n): return ((m:=n**n)*(n+1)**n>>n)-m*factorial(n) # _Chai Wah Wu_, Jan 25 2024
%Y A368366 Cf. A000027, A127610, A368372/A368373.
%Y A368366 See A368367-A368371, A369394 for further examples.
%Y A368366 The AGM transform of (n mod 2) is A276978.
%Y A368366 A368374 gives another way to look at the problem.
%K A368366 nonn
%O A368366 1,3
%A A368366 _N. J. A. Sloane_, Jan 24 2024