It is a special case of the following
Theorem $\ $ Suppose $\,f,g\in \Bbb Z[x]\,$ are polynomials, and $\,j\neq 0\,$ and $\,k,a\,$ are all integers.
If $\,\color{#c00}{f(a)=\pm1},\ \color{#0a0}{g(a) = 0}\ $ then $\,\dfrac{f(k)}{g(k)+ j\,\sqrt{k-a}} = i\in\Bbb Z$ $\ \Rightarrow\ $ $ k = 1\!+\!a\ $ or $\ f(k) = 0$
Proof $\ $ Clearing denom's we get $\, f(k)-ig(k) =\, ij \sqrt{k-a}.\ $ If $\,f(k)\neq 0\,$ then $\,i\neq 0\,$ therefore upon dividing by $\,ij\neq 0\,$ we deduce that $\,\sqrt{k-a}\in\Bbb Q.\,$ By the Rational Root Test we infer $\,\sqrt{k-a} = n\in\Bbb Z,\,$ so $\, k = n^2+a.\ $ If $\,n> 1\,$ then substituting this into the fraction
$$\dfrac{f(n^2+a)}{g(n^2+a)+ jn}\in\Bbb Z\qquad $$
$\qquad n\,\nmid f(n^2+a)\ $ since $\,\ {\rm mod}\ n\!:\,\ n\equiv 0\,\Rightarrow\,f(n^2+a)\equiv \color{#c00}{f(a)\equiv \pm1 \not \equiv 0}$
$\qquad n\,\mid g(n^2+a)\ $ since $\,\ {\rm mod}\ n\!:\,\ n\equiv 0\,\Rightarrow\,g(n^2+a)\equiv \color{#0a0}{g(a)\equiv 0}$
so $\,n>1\,$ divides the denominator but not the numerator, contra the fraction is an integer. Therefore $\,n = 1\,$ hence $\,k = n^2+a = 1+a.$