This is documentation for Mathematica 5, which was
based on an earlier version of the Wolfram Language.

 NumberTheory`ContinuedFractions` The decimal expansion is the most common way to represent a real number. This package supports two alternative representations as follows: (1) the continued fraction expansion of a real number and (2) the arbitrary base expansion of a rational number in terms of preperiodic and periodic parts. The continued fraction expansion of a real number is a representation of the form The integers are called the partial quotients. Rational numbers have a finite number of partial quotients, while irrational numbers have an infinite continued fraction expansion. Continued fractions also find application in the factorization of integers (see, for example, Chapter 10 in [Rosen]). If the number has partial quotients , the rational number formed by considering the first partial quotients , is called the convergent of . The convergents of a number provide, in a certain sense, the best rational approximation with a small denominator to the given real number. In Mathematica versions 4.0 and later, the kernel functions ContinuedFraction and RealDigits can be used to produce continued fraction and periodic representations of rational numbers. FromContinuedFraction and FromDigits are used to invert these operations. This package enhances these capabilities by providing functions for computing convergents and for nicely typesetting continued fractions and periodic forms. Continued fractions. This loads the package. In[1]:= <