TITLE: Integer solutions of $3a^2 - 2a - 1 = n^2$
QUESTION [7 upvotes]: 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!

REPLY [2 votes]: The first one can also be easely reduced to pytagorean one:
$$3a^2 - 2a - 1= 4a^2-(a^2+2a+1) \,.$$
Thus
$$n^2+(a+1)^2=(2a)^2 \,.$$