How to find the recurrence relationship from an equation? I have the restriction $8n^2-8n+1 = m^2$ and I want to find the recurrence relationship of all integers n that satisfy this equation.
I have figured out a recurrence relationship of $A_n$ = $6A_{n-1}$ - $A_{n-2}$ + 2, but I don't know how to prove that this is correct.
Can anyone explain it to me? Thanks a lot!

Your equation can be written as a negative Pell equation $m^2-2(2n-1)^2=-1$, which satisfies the well-known recurrence $2a_n-1=6(2a_{n-1}-1)-(2a_{n-2}-1)$, which simplifies to $a_n=6a_{n-1}-a_{n-2}-2$.
(The sequence of solutions for $2n-1$ in the above equation is given in OEIS.  )
