Pell's equation

Please enter a positive nonsquare integer N: ; or select one of the suggested values:

The fundamental solution to the Diophantine equation x 2 y 2 = 1 is given by x = and y = .

Try entering the following equalities in your Javascript console:



      

Note that xy is a fractional approximation of N with |xyN|1y(x+Ny)=110

The continued fraction algorithm provides the best rational approximations of N: =

In the previous formula, the same pattern is repeated indefinitely and the initial sequence is (incidentally, note that the first and last elements satisfy the equality = 2 × while the other elements form a palindrome). The values of x and y above were actually obtained by truncating the continued fraction to = = x y

Alternatively, these values can be obtained by the Chrakravala method:

where the following rules are used: