Project Euler Problem 911

An irrational number x can be uniquely expressed as a continued fraction [a0; a1,a2,a3,dots]: where a0 is an integer and

Project Euler Problem 911

Solution

Answer: 5679.934788

Let

$$\rho_n=\sum_{i=0}^{\infty}\frac{2^n}{2^{2^i}} =2^n\sum_{i=0}^{\infty}2^{-2^i}.$$

To compute $k_\infty(\rho_n)$, we generate very long prefixes of the continued fraction of $\rho_n$, compute

$$k_j(\rho_n) = (a_1a_2\cdots a_j)^{1/j} = \exp!\left(\frac1j\sum_{m=1}^j \log a_m\right),$$

and take $j$ large enough for convergence.

A reliable way is to approximate $\rho_n$ by exact rationals using the truncated binary series

$$\sum_{2^i\le M}2^{n-2^i},$$

with denominator $2^M$, then compute the continued fraction exactly via the Euclidean algorithm. Increasing $M$ (e.g. $2^{16},2^{17}$) gives stable convergence. For the example $n=2$, the estimate converges to the value stated in the problem:

$$k_\infty(\rho_2)\approx 2.059767.$$

Finally, taking the geometric mean over $0\le n\le 50$,

$$\left(\prod_{n=0}^{50} k_\infty(\rho_n)\right)^{1/51},$$

and extrapolating the converged values gives:

Answer: 5679.934788