%I #29 Jan 28 2024 02:03:27
%S 1,11,19,27,35,43,50,58,66,74,81,89,97,104,112,120,127,135,143,150,
%T 158,165,173,181,188,196,204,211,219,226,234,242,249,257,264,272,280,
%U 287,295,302,310,318,325,333,340,348,356,363,371,378,386,394,401,409,416
%N a(n) = smallest k such that AM(k) - GM(k) >= n, where AM(k) and GM(k) are the arithmetic and geometric means of [1,...,k].
%C 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.
%H Chai Wah Wu, <a href="/A368374/b368374.txt">Table of n, a(n) for n = 0..10000</a>
%e 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.
%p Digits:=20;
%p AM := proc(n) local i; add(i,i=1..n)/n; end;
%p GM := proc(n) local i; mul(i,i=1..n)^(1/n); end;
%p don := proc(n) evalf(AM(n) - GM(n)); end;
%p a:=[1]; w:=1;
%p for i from 1 to 300 do
%p if don(i) >= w then a:=[op(a),i]; w:=w+1; fi;
%p od:
%p a;
%o (Python)
%o from math import factorial
%o def A368374(n):
%o if n == 0: return 1
%o m = (n<<1)-1
%o kmin, kmax = m, m
%o while factorial(kmax)<<kmax > (kmax-m)**kmax:
%o kmax <<= 1
%o while True:
%o kmid = kmax+kmin>>1
%o if factorial(kmid)<<kmid <= (kmid-m)**kmid:
%o kmax = kmid
%o else:
%o kmin = kmid
%o if kmax-kmin <= 1:
%o break
%o return kmin+1 # _Chai Wah Wu_, Jan 27 2024
%Y Cf. A068996, A368366.
%K nonn
%O 0,2
%A _N. J. A. Sloane_, Jan 27 2024, following a suggestion from _Don Reble_
%E a(39)-a(54) from _Alois P. Heinz_, Jan 27 2024