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: hint
$$a^2+6a+1=b^2$$
$$\iff a^2+6a+1-b^2=0$$
the reduced  discriminant is
$$\Delta'=9-1+b^2=b^2+8$$
$$a=-3\pm \sqrt{b^2+8}$$
thus
$$b^2+8=c^2$$
and
$$(c+b)(c-b)=8$$
$$=4×2=-4×(-2)$$
$$c+b=\pm 4,\;\; c-b=\pm 2$$
gives $$\;\; b=\pm 1$$
and in all cases,
$$a=0 \text{ or } a=-6$$
A: $$
\\(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$
A: Everything to $(m-k)(m+k) = 8$ is valid.  
Note $m-k$ and $m+k$ have the same parity because $(m+k) - (m-k) = 2k$ is even so $m-k$ and $m+k$ are both even or both odd.  And as$(m-k)(m+k)$ is even they are both even  That cuts your trial and error by quite a bit.
The only the complete even factors of $8$ is $8 = \pm 2\cdot \pm 4$.  So one of $m+k, m-k$ is $\pm 2$ and the other is $\pm 4$.
So $|(m-k) - (m+k)| = 2|k|$ and $|(m-k) - (m+k)| = |\pm 4 - \pm 2| = 2$ so $k =\pm 1$.
So $a+3 = \pm 3$ and $a = 0, 6$.
