Find the value of an integer $a$ such that $ a^2 +6a +1 $ is a perfect square. I was able to solve this but it required me using hit and trial at one step. I was wondering if i could find a more solid method to solve it.
p.s. this is the first time im asking a question here so sorry if i couldn't construct the question properly.
this is my solution -
$a^2 + 6a + 1 = k^2$
$(a+3)^2 = k^2 + 8$
$k^2 + 8 = m^2 $    where [$m=a+3$]
$(m-k)(m+k) = 8$ ... here by inspection $m= 3$ and $k =1$
hence, $a = 0, -6$.

$$
\\(a+1)^2=a^2+2\cdot a+1\leq a^2+6\cdot a + 1 <a^2+6\cdot a+9=(a+3)^2
\\(a+1)^2\leq a^2+6\cdot a+1\leq(a+2)^2
\\=>
$$
if $\>a^2+6\cdot a + 1\>$ is a perfect square if and only if $\>a^2+6\cdot a + 1=(a+1)^2\>$ or $\>a^2+6\cdot a + 1=(a+2)^2\>=>\>a=0\>$ or $\>a=-6$
