The Pell's equation is a Diophantine equation of the form :
x2−Dy2=1
Where Dis a positive integer different from a perfect square.
The trivial solution to a pell equation is the couple (x,y)=(1,0)
Let (x1,y1)be the non-trivial minimum solution to the Pell's equation. Then all the
(xn,yn) are given by :
xn=k=0∑⌊2n⌋⎝⎛n2k⎠⎞Dk(x1)n−2k(y1)2k
yn=l=0∑⌊2(n−1)⌋⎝⎛n2l+1⎠⎞Dl(x1)n−2l−1(y1)2l+1
Good luck.