login
a(n) = round(1/(b(n) - round(b(n)))), where b(n) = sqrt(k) + sqrt(m) with k = A395621(n) and positive m < k minimizing the distance of b(n) from the nearest integer.
3

%I #15 Jun 17 2026 16:59:34

%S 7,-31,-108,-256,-311,-500,-864,-3408,-6660,-15760,-16384,19716,

%T -23328,-27436,-49800,-117156,-146328,-167728,-276848,-498204,-685720,

%U -864272,-1166928,-1588812,-1747584,-2291100,-2480112,-2623720,-3452640,-3675732,-5026016,-5838404,-6009380

%N a(n) = round(1/(b(n) - round(b(n)))), where b(n) = sqrt(k) + sqrt(m) with k = A395621(n) and positive m < k minimizing the distance of b(n) from the nearest integer.

%C A395621 lists nonsquare values k for which {sqrt(k) + sqrt(m); 0 < m < k, m not a square} has smaller distance from the integers than for all smaller nonsquare k > m > 0. This sequence lists the inverse of that distance, rounded to the nearest integer, with minus sign whenever the closest sqrt(k) + sqrt(m) is to the left of the nearest integer. (Thus, the larger the term, the closer is the sum to the nearest integer.)

%C Since k is nonsquare, sqrt(k) is not close to an integer: at best, k = s^2 +- 1 gives sqrt(k) = s*sqrt(1 +- 1/s^2) = s*(1 +- 1/2s^2 -+ ...) ~ s +- 1/2s. If m is a square, sqrt(k) + sqrt(m) is at the same distance from the integers as sqrt(k) alone. But we see that the minimum distance is always much smaller, viz. |a(n)| > 2*sqrt(A395621(n)). Therefore, the minimizing m will always be nonsquare, and we don't need to require this explicitly. - _M. F. Hasler_, Jun 13 2026

%e A395621(1) = 3 (the least nonsquare number k for which there exists a smaller positive nonsquare number m, namely 2), and sqrt(3) + sqrt(2) = 3.146... which is at distance 0.146... ~ 1/7 from the integers, hence a(1) = 7 = round(1/0.146...).

%e A395621(2) = 5, the next larger nonsquare number k for which there exists a smaller positive nonsquare number m, namely 3), such that sqrt(5) + sqrt(3) = 3.968... is closer to the nearest integer than the previous sum sqrt(3)+sqrt(2); hence a(1) = round(1/(3.968... - 4)) = round(-1/0.03188...) = -31. The minus sign shows that sqrt(5) + sqrt(3) is to the left of the nearest integer, 4.

%o (PARI) {A395624(n, k=A395621[n])=my(r=sqrt(k), b, d=oo);for(m=1,k-1, my(t=sqrt(m)+r);abs(t-round(t))<d && d=abs(t-round(b=t)));1\/(b-round(b))} \\ requires a predefined vector A395621 of initial values of that sequence; alternatively, A395621(n) can be otherwise specified as second (optional) argument, in which case the first argument (n) is ignored.

%Y Cf. A395621, A395625 (analog for A395622, which considers sums of three roots).

%K sign

%O 1,1

%A _M. F. Hasler_, Jun 03 2026