Conditions for $ax^2+ax+1$ to be a perfect square. I look for the conditions for $ax^2+ax+1$ to be a perfect square, like some sort of recursive algorithm. I have a fixed $a$ and I would like to express $x$ in terms of $a$ or any other form. (My peculiar case is $52x^2+52x+1$). Any help would be appreciated! 

if $a=4$, $x$ is any integer.
Assume $a \ne 0$,
$ax^2+ax+1 = 1$,   solution $x = 0, -1$
$ax^2+ax+1 = 4$,   solution $x = \frac{1}{2}\left(\frac{1}{\sqrt{\frac{a}{a+12}}}-1\right)$
$ax^2+ax+1 = 9$,   solution $x = \frac{1}{2}\left(\frac{1}{\sqrt{\frac{a}{a+32}}}-1\right)$
$ax^2+ax+1 = 16$,  solution $x = \frac{1}{2}\left(\frac{1}{\sqrt{\frac{a}{a+60}}}-1\right)$
$ax^2+ax+1 = 25$,  solution $x = \frac{1}{2}\left(\frac{1}{\sqrt{\frac{a}{a+96}}}-1\right)$
$ax^2+ax+1 = 36$,  solution $x = \frac{1}{2}\left(\frac{1}{\sqrt{\frac{a}{a+140}}}-1\right)$
$ax^2+ax+1 = 49$,  solution $x = \frac{1}{2}\left(\frac{1}{\sqrt{\frac{a}{a+192}}}-1\right)$ 
Any pattern ? 12, 32, 60, 96, 140, 192,...

12 - 0 = 10 + 2
32 - 12 = 20 - 0
60 - 32 = 30 - 2
96 - 60 = 40 - 4
140 - 96 = 50 - 6
192 - 140 = 60 - 8  
Seems there is a pattern. 
$$x =  \frac{1}{2}\left(\frac{1}{\sqrt{\frac{a}{a+\sum_{i=1}^{z}(8i+4)}}}-1\right)$$
where, $z \in \mathbb{N}$
