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