Periodic continued fraction

This article considers only the case of periodic regular continued fractions.

In other words, the remainder of this article assumes that all the partial denominators ai (i ≥ 1) are positive integers.

The general case, where the partial denominators ai are arbitrary real or complex numbers, is treated in the article convergence problem.

Since all the partial numerators in a regular continued fraction are equal to unity we can adopt a shorthand notation in which the continued fraction shown above is written as where, in the second line, a vinculum marks the repeating block.

[1] Some textbooks use the notation where the repeating block is indicated by dots over its first and last terms.

[2] If the initial non-repeating block is not present – that is, if k = -1, a0 = am and the regular continued fraction x is said to be purely periodic.

of the golden ratio φ is purely periodic, while the regular continued fraction

Periodic continued fractions are in one-to-one correspondence with the real quadratic irrationals.

The correspondence is explicitly provided by Minkowski's question-mark function.

That article also reviews tools that make it easy to work with such continued fractions.

Consider first the purely periodic part This can, in fact, be written as with the

Explicit values can be obtained by writing which is termed a "shift", so that and similarly a reflection, given by so that

By the quadratic formula, every quadratic irrational can be written in the form where P, D, and Q are integers, D > 0 is not a perfect square (but not necessarily square-free), and Q divides the quantity

Such a quadratic irrational may also be written in another form with a square-root of a square-free number (for example

By considering the complete quotients of periodic continued fractions, Euler was able to prove that if x is a regular periodic continued fraction, then x is a quadratic irrational number.

From the fraction itself, one can construct the quadratic equation with integral coefficients that x must satisfy.

Lagrange proved the converse of Euler's theorem: if x is a quadratic irrational, then the regular continued fraction expansion of x is periodic.

[4] Given a quadratic irrational x one can construct m different quadratic equations, each with the same discriminant, that relate the successive complete quotients of the regular continued fraction expansion of x to one another.

Since there are only finitely many of these equations (the coefficients are bounded), the complete quotients (and also the partial denominators) in the regular continued fraction that represents x must eventually repeat.

Galois proved that the regular continued fraction which represents a quadratic surd ζ is purely periodic if and only if ζ is a reduced surd.

He also proved that if ζ is a reduced quadratic surd and η is its conjugate, then the continued fractions for ζ and for (−1/η) are both purely periodic, and the repeating block in one of those continued fractions is the mirror image of the repeating block in the other.

In symbols we have where ζ is any reduced quadratic surd, and η is its conjugate.

From these two theorems of Galois a result already known to Lagrange can be deduced.

If r > 1 is a rational number that is not a perfect square, then In particular, if n is any non-square positive integer, the regular continued fraction expansion of √n contains a repeating block of length m, in which the first m − 1 partial denominators form a palindromic string.

is expanded as a regular continued fraction, Lagrange showed that the largest partial denominator ai in the expansion is less than

More recently, sharper arguments [5][6][7] based on the divisor function have shown that the length of the repeating block for a quadratic surd of discriminant D is on the order of

The following iterative algorithm [8] can be used to obtain the continued fraction expansion in canonical form (S is any natural number that is not a perfect square): Notice that mn, dn, and an are always integers.

Consequently, the simple continued fraction for the square root of 114 is √114 is approximately 10.67707 82520.

A more rapid method is to evaluate its generalized continued fraction.

From the formula derived there: and the fact that 114 is 2/3 of the way between 102=100 and 112=121 results in which is simply the aforementioned