# Wolfram Language & System 10.4 (2016)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.
BUILT-IN WOLFRAM LANGUAGE SYMBOL

# ContinuedFraction

ContinuedFraction[x,n]
generates a list of the first n terms in the continued fraction representation of x.

generates a list of all terms that can be obtained given the precision of x.

## DetailsDetails

• The continued fraction representation corresponds to the expression .
• x can be either an exact or an inexact number.
• For exact numbers, can be used if x is rational, or is a quadratic irrational.
• For quadratic irrationals, 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[x,n] 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.
• FromContinuedFraction[list] reconstructs a number from the result of ContinuedFraction.

## ExamplesExamplesopen allclose all

### Basic Examples  (1)Basic Examples  (1)

20 terms in the continued fraction for :

 In[1]:=
 Out[1]=