Least $j$ such that $j^2 - k$ is a square? Given a positive integer $k$, how do we find the least integer $j$ such that $j^2-k$ is a perfect square?
E.g. say $k = 75 = 25 \times 3 = 15 \times 5$. How do we know that the least $j$ in this case is $\frac 12 (15+5) = 10$ and not $\frac 12 (25+3) = 14$?

Suppose that:
$$j^2-k=a^2$$
then:
$$k=j^2-a^2=(j-a)(j+a)$$
If you know factorization of $k$, that means all pair of $(m,n)$ such that:
$$mn=k$$
You can find solution of system of equations:
$$n=j+a$$
$$m=j-a$$
For all $m,n$. Adding this equation side by side you have:
$$j=\frac{m+n}{2}$$
So the less $j$ corresponds to pair $m,n$ where mean:
$$\frac{m+n}{2}$$
is the smallest possible.
