### Calculating the positive and negative representations of the regular continued fraction of a quadratic irrational

This program finds the positive and negative representations of the regular continued fraction expansion of a
quadratic irrational (u + t√d)/v, where d,t,u,v are integers, d >1 and nonsquare, t and v nonzero, as far as the end of the first period.

We use the continued fraction algorithm as described in K. Rosen,
*Elementary Number theory and its applications*, 379-381 and Knuth's
*The art of computer programming*, Vol. 2, p. 359.

The first reduced complete quotient ξ_{i} is located and this leads to the period ξ_{i},...,ξ_{i+j-1}, which is printed in **bold** font.

We write (p,q) to denote (p + √d)/q.
(Also see MP313 lecture notes.)

*Last modified 17th March 2009*

Return to main page