<s>[INST] How to prove $n^2+d$ is not square if $d|2n^2$ ? $n,d$ are positive integers. Obverously,if $n\ge d>0$,then
$$n^2<n^2+d<n^2+2n+1=(n+1)^2$$
So,$n^2+1$ is not square.
Naturelly,we consider $d>n$,but I can't get contradiction.And I do not use $d|2n^2$.
If we assume a positive $r$ s.t. $\sqrt{n^2+d}=r$,then we have $n^2+d = r^2$.From above equation , we can get $d|(n^2+r^2)$ and $d=r^2-n^2$.But I think it just identical transformation.I can't get useful information.
So ,can you give me some hints?Thanks!
 [/INST] If $n=0$ then take $d$ any square to get a counterexample.  So now let’s assume $n \neq 0$ and let $q\neq 0$ be an integer such that $q d = 2 n^2$.  Suppose $n^2 + d = m^2$ for some integer $m$.  Multiply both sides by $q^2$ to get $$(q^2 + 2q) n^2 = (q m)^2$$ and rewrite this as $$(q+1)^2 - 1 = \left(\frac{q m}n \right)^2.$$ Note that the right hand side is an integer and therefore $qm/n$ must also be an integer.  So both $(q+1)^2$ and $(q+1)^2-1$ are squares.  This implies $(q+1)^2 = 1$ and therefore $m=0$.
Conclusion: if $d\mid 2n^2$ and $n^2 + d$ is a square then either $n=0$ and $d$ is a square or $n\neq 0$ and $d = -n^2$.
</s>