This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
 BUILT-IN MATHEMATICA SYMBOL Tutorials »| See Also »| More About »

# ContinuedFraction

 ContinuedFractiongenerates a list of the first n terms in the continued fraction representation of x. ContinuedFraction[x]generates a list of all terms that can be obtained given the precision of x.
• The continued fraction representation corresponds to the expression .
• x can be either an exact or an inexact number.
• For exact numbers, ContinuedFraction[x] can be used if x is rational, or is a quadratic irrational.
• For quadratic irrationals, ContinuedFraction[x] returns a result of the form , corresponding to an infinite sequence of terms, starting with the , and followed by cyclic repetitions of the . »
• Since the continued fraction representation for a rational number has only a limited number of terms, ContinuedFraction may yield a list with less than n elements in this case.
• For terminating continued fractions, is always equivalent to ; ContinuedFraction returns the first of these forms.
20 terms in the continued fraction for :
20 terms in the continued fraction for :
 Out[1]=
 Scope   (2)
Rational number:
Quadratic irrational (recurring continued fraction):
ContinuedFraction stops when it runs out of precision:
 Applications   (3)
The continued fractions for n roots of are very regular:
Geometric mean of the first 1000 continued fraction terms in :
An almost-integer:
FromContinuedFraction is effectively the inverse of ContinuedFraction:
Explicit representation using nested fractional parts:
Objects showing regularity in their continued fractions:
New in 4