login
Least positive integer k such that 1 + 1/2 + ... + 1/n < 1/(n+1) + ... + 1/(n+k).
2

%I #17 Sep 26 2021 01:55:41

%S 3,9,19,32,49,69,93,121,152,187,225,266,312,361,413,469,529,592,658,

%T 729,802,880,961,1045,1133,1225,1320,1419,1521,1627,1736,1849,1966,

%U 2086,2210,2337,2468,2602,2740,2882,3027,3175,3327,3483,3642,3805,3972,4142

%N Least positive integer k such that 1 + 1/2 + ... + 1/n < 1/(n+1) + ... + 1/(n+k).

%H Clark Kimberling, <a href="/A226184/b226184.txt">Table of n, a(n) for n = 1..200</a>

%F a(n) = A226183(n) - n. - _Michel Marcus_, Sep 09 2021

%e a(3) = 19 because 1/4 + 1/5 + ... + 1/(3+18) < 1 + 1/2 + 1/3 < 1/4 + 1/5 + ... + 1/(3+19).

%t z = 55; f[n_] := 1/n; p[n_] := p[n] = Sum[f[k], {k, 1, n}]; Do[s = 0; a[n] = NestWhile[# + 1 &, 1, ! (s += f[#]) >= 2 p[n] &], {n, 1, z}]; m = Map[a, Range[z]] (* A226183 *)

%t m1 = Table[m[[n]] - n, {n, 1, z}] (* A226184 *)

%Y Cf. A226183, A289183.

%K nonn

%O 1,1

%A _Clark Kimberling_, May 30 2013