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