OFFSET
0,2
COMMENTS
The difference d(x) = AM(1,2,3,...,x) - GM(1,2,3,...,x) increases. The first difference of d(x) approaches a limit, 1/2 - 1/e (0.13212...). So we could define a(n) to be the least x such that d(x) >= n. - Don Reble, Jan 27 2024. Which is what I did.
LINKS
Chai Wah Wu, Table of n, a(n) for n = 0..10000
EXAMPLE
The values of AM(i)-GM(i) for i = 1, ..., 11 are 0, 0.0857864376269049512, 0.1828794071678603411, 0.2866361605993568152, 0.3948289153026481077, 0.5062048344760910451, 0.6199848408587035501, 0.7356494004968713999, 0.8528337256030871195, 0.9712713118832352378, 1.0907612204156046410, so a(1) = 11.
MAPLE
Digits:=20;
AM := proc(n) local i; add(i, i=1..n)/n; end;
GM := proc(n) local i; mul(i, i=1..n)^(1/n); end;
don := proc(n) evalf(AM(n) - GM(n)); end;
a:=[1]; w:=1;
for i from 1 to 300 do
if don(i) >= w then a:=[op(a), i]; w:=w+1; fi;
od:
a;
PROG
(Python)
from math import factorial
def A368374(n):
if n == 0: return 1
m = (n<<1)-1
kmin, kmax = m, m
while factorial(kmax)<<kmax > (kmax-m)**kmax:
kmax <<= 1
while True:
kmid = kmax+kmin>>1
if factorial(kmid)<<kmid <= (kmid-m)**kmid:
kmax = kmid
else:
kmin = kmid
if kmax-kmin <= 1:
break
return kmin+1 # Chai Wah Wu, Jan 27 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Jan 27 2024, following a suggestion from Don Reble
EXTENSIONS
a(39)-a(54) from Alois P. Heinz, Jan 27 2024
STATUS
approved