OFFSET
1,1
COMMENTS
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.)
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
EXAMPLE
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...).
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.
PROG
(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.
CROSSREFS
KEYWORD
sign
AUTHOR
M. F. Hasler, Jun 03 2026
STATUS
approved
