# Lochs's theorem

In number theory, Lochs's theorem concerns the rate of convergence of the continued fraction expansion of a typical real number. A proof of the theorem was published in 1964 by Gustav Lochs.
The theorem states that for almost all real numbers in the interval (0,1), the number of terms m of the number's continued fraction expansion that are required to determine the first n places of the number's decimal expansion behaves asymptotically as follows:
    $\lim _{n\to \infty }{\frac {m}{n}}={\frac {6\ln(2)\ln(10)}{\pi ^{2}}}\approx 0.97027014$ (sequence A086819 in the OEIS).
As this limit is only slightly smaller than 1, this can be interpreted as saying that each additional term in the continued fraction representation of a "typical" real number increases the accuracy of the representation by approximately one decimal place. The decimal system is the last positional system for which each digit carries less information than one continued fraction quotient; going to base-11 (changing $\ln(10)$ to $\ln(11)$ in the equation) makes the above value exceed 1.
The reciprocal of this limit,
    ${\frac {\pi ^{2}}{6\ln(2)\ln(10)}}\approx 1.03064083$ (sequence A062542 in the OEIS),
is twice the base-10 logarithm of Lévy's constant.
A prominent example of a number not exhibiting this behavior is the golden ratio—sometimes known as the "most irrational" number—whose continued fraction terms are all ones, the smallest possible in canonical form. On average it requires approximately 2.39 continued fraction terms per decimal digit.

## Proof

The proof assumes basic properties of continued fractions. Let $T:x\mapsto 1/x\mod 1$ be the Gauss map.
Let $\rho (t)={\frac {1}{(1+t)\ln 2}}$ be the probability density function for the Gauss distribution, which is preserved under the Gauss map.
Since the probability density function is bounded above and below, a set is negligible with respect to the Lebesgue measure iff to the Gauss distribution.

### Lemma

Lemma. 1/n ln⁡T$^n$x→0{\textstyle {\frac {1}{n}}\ln T^{n}x\to 0}.
Proof. Since T$^n$x≤1{\textstyle T^{n}x\leq 1}, we have 1/n ln⁡T$^n$x→0{\textstyle {\frac {1}{n}}\ln T^{n}x\to 0} iff$\liminf {\frac {1}{n}}\ln T^{n}x=0$Let us consider the set of all x{\textstyle x} that have lim inf 1/n ln⁡T$^n$x<0{\textstyle \liminf {\frac {1}{n}}\ln T^{n}x<0}. That is,$\{x:\exists c>0,\forall N\geq 1,\exists n\geq N,T^{n}x<e^{-cn}\}$ $=\cup _{c>0}\cap _{N\geq 1}\cup _{n\geq N}[0;\mathbb {N} ,\dots ,\mathbb {N} ,a_{n}>e^{cn},\mathbb {N} ,\dots ]$where $[0;\mathbb {N} ,\dots ,\mathbb {N} ,a_{n}>e^{cn},\mathbb {N} ,\dots ]$ denotes the set of numbers whose continued fraction expansion has $a_{n}>e^{cn}$, but no other constraints. Now, since the Gauss map preserves the Gauss measure,$[0;\mathbb {N} ,\dots ,\mathbb {N} ,a_{n}>e^{cn},\mathbb {N} ,\dots ]$has the same Gauss measure as [0;a$_n$>e$^{cn}$, N, …]{\textstyle [0;a_{n}>e^{cn}, \mathbb {N} , \dots ]}, which is the same as
$\int _{0}^{e^{-cn}}\rho (t)dt=\log _{2}(1+e^{-cn})\sim {\frac {e^{-cn}}{\ln 2}}$The union over ∪$_{n≥N}${\textstyle \cup _{n\geq N}} sums to ∼ e$^{−cN}$/(1−e$^{−c}$)ln⁡2 {\textstyle \sim {\frac {e^{-cN}}{(1-e^{-c})\ln 2}}}, which at the N→∞{\textstyle N\to \infty } limit is zero.
Thus the set of such x{\textstyle x} has Gauss measure zero.

### Finish the estimate

Now, expand the term using basic continued fraction properties:$\ln \left|x-{\frac {p_{n}}{q_{n}}}\right|=\ln {\frac {T^{n}x}{q_{n}(q_{n}+q_{n-1}T^{n}x)}}=-2\ln q_{n}+\ln T^{n}x-\ln \left(1+{\frac {q_{n-1}}{q_{n}}}T^{n}x\right)$The second is o(n){\textstyle o(n)}. The third term is ∈[ln⁡1, ln⁡2]{\textstyle \in [\ln 1, \ln 2]}. Both disappear after dividing by $n$. Thus$\lim _{n}{\frac {1}{n}}\ln \left|x-{\frac {p_{n}}{q_{n}}}\right|=-2\lim _{n}{\frac {1}{n}}\ln q_{n}=-{\frac {\pi ^{2}}{6\ln 2}}$where we used the result from Lévy's constant.