Integer solutions of $3a^2 - 2a - 1 = n^2$ I've got an equation $3a^2 - 2a - 1 = n^2$, where $a,n \in \mathbb{N}$.
I put it in Wolfram Alpha and besides everything else it gives integer solution: see here.
For another equation (say, $3a^2 - 2a - 2 = n^2$, where $a,n \in \mathbb{N}$) Wolfram Alpha does not provide integer solutions: here.
Could you please tell me:


*

*How does Wolfram Alpha determine existence of the integer solutions?

*How does it find them?

*What should I learn to be able to do the same with a pencil and a piece of paper (if possible)?


Thanks in advance!

I believe Pell's Equation (and variants) would be useful.
The first one can be recast as
$$9a^2 - 6a - 3 = 3n^2$$ i.e. 
$$(3a-1)^2 - 4 = 3n^2$$
You are looking for solutions to
$$ x^2 - 3y^2 = 4$$ such that $x = -1 \mod 3$.
There are standard techniques to solve Pell's equation and variants (see the wiki page linked above and mathworld page here: http://mathworld.wolfram.com/PellEquation.html) and I am guessing Wolfram Alpha is using one of them.
For the second I believe we get
$$x^2 - 3y^2 = 7$$
which does not have solutions, considering modulo $4$ (as pointed out by Adrián Barquero).
