<s>[INST] How to find solutions of $x^2-3y^2=-2$? According to MathWorld,

Pentagonal Triangular Number: A number which is simultaneously a pentagonal number $P_n$ and triangular number $T_m$. Such numbers exist when
  $$\frac{1}{2}n(3n-1)=\frac{1}{2}m(m+1).$$
  Completing the square gives
  $$(6n-1)^2-3(2m+1)^2=-2.$$
  Substituting $x=6n-1$ and $y=2m+1$ gives the Pell-like quadratic Diophantine equation
  $$x^2-3y^2=-2,$$
  which has solutions $(x,y)=(5,3),(19,11),(71,41),(265,153), \ldots$.

However, it does not state how these solutions for $(x,y)$ were obtained.
I know that the solution $(5,3)$ can be obtained by observing that $1$ is both a pentagonal and a triangular number.
Does obtaining the other solutions simply involve trial-and-error? Or is there a way to obtain these solutions?
 [/INST] Here's another approach.
$$X^2-AY^2=B\tag1$$
$$x^2-Ay^2=1\tag2$$
If we know fundamental solution $(a,b/A)$ for $(2)$ and “trivial” solutions $(t,v)$ for $(1)$ then:
$$X_n = \sum_{k=0}^{n}\frac{a^{n-k}b^k\displaystyle\binom{n}{k}\left(\left(\left\lceil\frac{k}{2}\right\rceil -\left\lfloor\frac{k}{2}\right\rfloor\right)v + \left(\left\lceil\frac{k+1}{2}\right\rceil -\left\lfloor\frac{k+1}{2}\right\rfloor\right)t\right)}{A^{\left\lfloor\frac{k}{2}\right\rfloor}}$$
$$Y_n = \sum_{k=0}^n \frac{a^{n-k}b^k\displaystyle\binom{n}{k}\left(\left( \left\lceil\frac{k+1}{2}\right\rceil -\left\lfloor\frac{k+1}{2}\right\rfloor\right)v + \left(\left\lceil\frac{k}{2}\right\rceil - \left\lfloor\frac{k}{2}\right\rfloor\right)t\right)}{A^{\left\lceil\frac{k}{2}\right\rceil}}$$
For $X^2 -3Y^2 = -2$; $t = 1, v = 1, a = 2, b/A = 1$
$$X_n = \sum_{k=0}^n 3^{k-\left\lfloor\frac{k}{2}\right\rfloor}2^{n-k}\binom{n}{k}$$
$$Y_n = \sum_{k=0}^n 3^{k-\left\lceil\frac{k}{2}\right\rceil}2^{n-k}\binom{n}{k}$$
</s>