Solving Pell's equation using the nearest integer continued fraction in Die Lehre von den Kettenbrüchen, Oscar Perron, Band I, p. 143

This is a version of the 6 cases algorithm of H.C. Williams and P.A. Buhr, Calculation of the regulator of Q(√D) by use of the nearest integer continued fraction algorithm, H.C. Williams and P.A. Buhr, Math. Comp. 33 (1979) 369-381, where we have used the nearest integer continued fraction (NICF-P) of page 143 of Perron's book, instead of the closely related Hurwitz-Minnegerode nearest integer continued fraction (NICF-H).

For an account of the connection between NICF-P and NICF-H, see paper.

E = 1 prints complete quotients, partial numerators and denominators and convergents;
E = 0 prints the least solution of Pell's equation and the NICF-P period length.

Enter d (1 < d < 1016 and non-square:)
Enter E (0 or 1):

Last modified 20th January 2009
Return to main page