Q:

For which $r$ the expression $\sqrt{4s+ r^2}$ is an integer?

Let's assume $s$ is a non-negative composite integer. We need to find such a $r$ (also integer, non-negative and $r < s-1 $), for which the square root $\sqrt{4s + r^2}$ will yield an integer? Any ideas?

A:

The condition $r<s-1$ gives you troubles. For example, if $s$ is any prime number larger than $3$, there is no such $r$.
Suppose by contradiction that there exist $a,r \ge 0$ such that $a^2-r^2=4s$. Then
$$4s=(a+r)(a-r)$$
since $a+r, a-r$ must be both even (their difference is even, and their product is even), we have $a+r, a-r \in \{ \mbox{even divisors of } 4s\} = \{ 2,4,2s,4s\}$. Actually, $4$ and $4s$ must be discarded, since $4s/4$ and $4s/4s$ are odd.
So, necessarily $a+r=2s$ and $a-r=2$, yelding $r=s-1$ and $a=s+1$.
For all composite numbers, though, this can be done: if $p$ is the smallest prime dividing $s$, you can pick $a-r=2p$, $a+r=2s/p$.

