When is this integer a perfect square: $n^2 + 20n + 12$

Notice that: $$S_n=n^2+20n+12=(n+10)^2-88 \ .$$

Assume that $S_n$ to be a perfect square; i.e. $S_n=m^2$, then we have: $(n+10)^2-88=m^2$,

let's dfine $N:=(n+10)$.

This implies that $(N-m)(N+m)=88$; notice that $(N-m)$ and $(N+m)$ have the same pairity, both of them are odd or both of them are even. We have the following cases:



  1. $(N-m)= 1$ and $(N+m)=88$; which is imposible by the above notices.

  2. $(N-m)= 2$ and $(N+m)=44$; which gives the solution $N=23$, $m=21$; $n=13$.

  3. $(N-m)= 4$ and $(N+m)=22$; which gives the solution $N=13$, $m=9$; $n=3$.

  4. $(N-m)= 8$ and $(N+m)=11$; which is imposible by the above notices.

  5. $(N-m)=11$ and $(N+m)= 8$; which is imposible by the above notices.

  6. $(N-m)=22$ and $(N+m)= 4$; which gives the solution $N=13$, $m=-9$; $n=3$.

  7. $(N-m)=44$ and $(N+m)= 2$; which gives the solution $N=23$, $m=-21$; $n=13$.

  8. $(N-m)=88$ and $(N+m)= 1$; which is imposible by the above notices.



At first you without loss of generality you can assume that $m$ is non-negative, and also note that $ N = n+10 > 0+10=10.$


Use $$(n+4)^2<n^2+20n+12<(n+10)^2.$$ I got $n^2+20n+12=(n+8)^2$, which gives $n=13$ or

$n^2+20n+12=(n+6)^2$, which gives $n=3$.

Id est, the answer is $16$

because in cases $n^2+20n+12=(n+5)^2$, $n^2+20n+12=(n+7)^2$ and $n^2+20n+12=(n+9)^2$ we can not get solutions.


$ n^{2}+20n+12=k^{2} \iff k \in \mathbb{Z}$ then we proceed with $ (n+10)^{2}-k^{2}=88 $ (I have skipped the operations). If we factor them out $\implies (n+10-k)\cdot(n+10+k)=88$, and match them with the factors of $88$ such that both $n \land k \in \mathbb{Z}$, the problem is done.