Question on Functions and Squares.

I was solving this question, and I'm hitting a wall.

Let $S_n=n^2+20n+12$, ${{n}\in{\mathbb{N}}}$. What is the sum of all possible values of $n$ for which $S_n$ is a perfect square?

Here is how I have tried to solve.

\begin{align}n&\equiv0,1,2,...,9\pmod{10}\\\text{So,}\qquad S_n&\equiv1,6\pmod{10}\\\text{So,}\qquad n&\equiv2,3,7,8\pmod{10}\end{align}

But even then I have an infinite number of numbers. I have no idea where to go now.

Can anyone help?

The equation $n^2 + 20 n + 12 = m^2$ has the positive solution $n=\sqrt{m^2+88}-10$

$n$ is integer if $m^2+88$ is a perfect square that is if $m^2+88=y^2$ which can be written as

$(y+m)(y-m)=88$ and $y>m$

This gives only two possibilities $m=9;\;m=21$

Thus $n$ can be $3$ or $13$

Hint:

Let $$n^2+20n+12 = m^2$$

$$(n+10)^2-100+12 = m^2$$ $$(n+10)^2-m^2 = 88$$ $$(n+10-m)(n+10+m)=88$$

I'm not sure if you could solve it in your way. An easier way is try completing the square by using that: $$(a + b)^2 = a^2 + 2ab + b^2$$ $$\Rightarrow n^2 + 20n + 12 = n^2 + 2*10n + 100 - 88 = (n + 10)^2 -88$$ Now by using that $S_n$ has to be a perfect square, you should be able to find your answers.