History [of continued fractions]

Euclid's algorithm states that starting from integers {a,b} iterating {a_, b_} If[a > b, {a - b, b}, {a, b - a}] eventually leads to {GCD[a, b], 0}. (See page 1093.) The pictures below show how this works. The numbers of successively smaller squares (corresponding to the numbers of steps in the algorithm) turn out to be exactly ContinuedFraction[a/b].

It was discovered in antiquity that Euclid's algorithm starting with {x, 1} terminates only when x is rational. In all cases, however, the relationship with continued fractions remains, as below.

Infinite continued fractions appear to have first been explicitly written down in the mid-1500s, and to have become popular in many problems in number theory by the 1700s. Leonhard Euler studied many continued fractions, while Joseph Lagrange seems to have thought that it might be possible to recognize any algebraic number from its continued fraction. The periodicity of continued fractions for quadratic irrationals was proved by Evariste Galois in 1828. From the late 1800s interest in continued fractions as such waned; it finally increased again in the 1980s in connection with problems in dynamical systems theory.