login
a(n) is the nearest integer to 1/(H(k) - n), where H(k) is the smallest harmonic number that exceeds n.
1

%I #56 Mar 03 2022 15:22:00

%S 1,2,12,50,37,483,229,785,2059,4806,23251,56470,327690,813351,734186,

%T 2643630,10476269,67340402,268822185,102740092,618260119,2491694355,

%U 7222972533,50525424196,44010188391,164490666033,131444704333,548839044705,1808874061272,9913711133738

%N a(n) is the nearest integer to 1/(H(k) - n), where H(k) is the smallest harmonic number that exceeds n.

%C The k-th harmonic number, H(k), is Sum_{j=1..k} 1/j. A002387(n) is the smallest k such that H(k) > n.

%H Peter Luschny, <a href="/A352026/b352026.txt">Table of n, a(n) for n = 0..100</a>

%F a(n) = round(1/(H(A002387(n)) - n)).

%e H(2) = 1/1 + 1/2 = 3/2 = 1.5;

%e H(3) = 1/1 + 1/2 + 1/3 = 11/6 = 1.8333...;

%e H(4) = 1/1 + 1/2 + 1/3 + 1/4 = 25/12 = 2.08333..., which is the first harmonic number that exceeds 2, so a(2) = round(1/(25/12 - 2)) = round(1/(1/12)) = 12.

%e H(10) = 7381/2520 = 2.92896...;

%e H(11) = 83711/27720 = 3.01987..., which is the first harmonic number > 3, and the fractional part of 83711/27720 = 551/27720, so a(3) = round(27720/551) = round(50.30852...) = 50.

%o (PARI) a(n)={my(s=0,k=0); while(s<=n, k++;s+=1/k); round(1/(s-n))} \\ _Andrew Howroyd_, Mar 01 2022

%o (SageMath)

%o RR = RealField(1000)

%o def A352026(n):

%o g = RR.euler_constant()

%o u = exp(RR(n) - g)

%o a = u + RR(3/2) - RR(1/(24*u)) + RR(3/(640*u^3))

%o h = RR(psi(RR(floor(a)))) + g

%o return round(RR(1/(h - RR(n))))

%o print([A352026(n) for n in range(30)]) # _Peter Luschny_, Mar 03 2022

%Y Cf. A001008, A002805, A002387.

%K nonn

%O 0,2

%A _Sebastian F. Orellana_, Feb 28 2022

%E More terms from _Peter Luschny_, Mar 01 2022