 is eventually repeating if and only if
 is eventually repeating if and only if  is
rational.  The proof that continued fractions of quadratic irrationals
eventually repeats is surprisingly difficult and involves an
interesting finiteness argument.  
Section 5.4.2 emphasizes our striking ignorance about
continued fractions of real roots of irreducible polynomials over
 is
rational.  The proof that continued fractions of quadratic irrationals
eventually repeats is surprisingly difficult and involves an
interesting finiteness argument.  
Section 5.4.2 emphasizes our striking ignorance about
continued fractions of real roots of irreducible polynomials over 
 of degree bigger than
of degree bigger than  .
.
 is a quadratic irrational 
if it is irrational and satisfies a quadratic polynomial 
with coefficients in
 is a quadratic irrational 
if it is irrational and satisfies a quadratic polynomial 
with coefficients in 
 .
. is a quadratic irrational.
Recall that
 is a quadratic irrational.
Recall that
![$\displaystyle \frac{1+\sqrt{5}}{2} = [1,1,1,\ldots].
$](img1872.png) 
The continued fraction of
 is
 
is 
![$ [1,2,2,2,2,2,\ldots]$](img1874.png) , and
the continued fraction of
, and
the continued fraction of 
 is
 is
![$\displaystyle [19,1,2,1, 1, 1, 1, 2, 1, 38, 1, 2, 1, 1, 1, 1, 2, 1, 38,\ldots].$](img1876.png) 
Does the
![$ [1,2,1, 1, 1, 1, 2, 1, 38]$](img1877.png) pattern repeat over and over again?
 pattern repeat over and over again?
 using SAGE:
using SAGE:
sage: def cf_sqrt_d(d, bits): ... x = sqrt(RealField(bits)(d)) ... return continued_fraction(x) sage: cf_sqrt_d(389,50) [19, 1, 2, 1, 1, 1, 1, 2, 1, 38, 1, 2, 1, 1, 1, 1, 2, 1, 38] sage: cf_sqrt_d(389,100) [19, 1, 2, 1, 1, 1, 1, 2, 1, 38, 1, 2, 1, 1, 1, 1, 2, 1, 38, \ 1, 2, 1, 1, 1, 1, 2, 1, 38, 1, 2, 1, 1, 1, 1, 2, 1, 38, 1, 2, 1, 1]