This is a program for finding the least solutions of diophantine equations x2 - dy2 = ±1, ±2, ±3 and the least primitive solutions of x2 - dy2 = ±4.
The algorithm is based on K. Rosen, Elementary number theory and its applications, p.382,
B.A. Venkov, Elementary Number Theory, p.62 and
D. Knuth, Art of computer programming, Vol.2, p.359.
Also see L. Holzer, Zahlentheorie, Kap. 38, Satz 9, Seite 171,
which states that if d > 2, then no two of
x2 - dy2 = -1,
x2 - dy2 = -2,
x2 - dy2 = 2,
are simultaneously soluble.
e=1 prints the complete quotients (P+√d)/Q and partial quotients of the period of ⌊√d⌋+√d.
Last modified 26th November 2003
Return to main page