Through the Ramanujan machine project, we explore the world of convergent polynomial continued fractions and leverage a range of algorithms to predict their limits. While these predictions provide us with computer-generated approximations that align with the limit of the continued fraction to a high degree of precision, we understand that these values are merely estimations. In our pursuit of a more complete understanding, we turn to the mathematical side of the project, where we aim to investigate and validate these approximations through rigorous proof.

For example, denoting generalized continued fractions as

\( \mathbb{K}_1^\infty \frac{b_n}{a_n} = \frac{b_1}{a_1 + \frac{b_2}{a_2 + \frac{b_3}{a_3 + \ddots}} } \),

then one such result is

\( \mathbb{K}_1^\infty \frac{-n^{2d}}{n^d+(1+n)^d} = \frac{1}{\zeta(d)} – 1\) where \( \zeta(d) := \sum_1^\infty \frac{1}{n^d} \) is the Riemann zeta function.

In order to prove such equations, we go to none other than Euler himself:

Euler’s Formula

For any complex sequence \( r_1, r_2, r_3, … \) the following holds:

\( 1+r_{1}+r_{1}r_{2}+\cdots+r_{1}\cdots r_{n}=\sum_{k=0}^{n}\left(\prod_{i=1}^{k}r_{i}\right)=\frac{1}{1+\mathbb{K}_{1}^{n}\frac{-r_{i}}{1+r_{i}}} \)

By taking the limit, if exists, we get

\( \mathbb{K}_{1}^{\infty}\frac{-r_{i}}{1+r_{i}}=\frac{1}{\sum_{k=0}^{\infty}\prod_{i=1}^{k}r_{i}}-1. \)

Proof (press to see):



We first note a simple equation regarding the expressions appearing in continued fractions:

\( 1+r\cdot \frac{1}{x} =\frac{r+x}{x} = \frac{1}{\frac{x}{r+x}} = \frac{1}{1+\frac{-r}{r+x}}\)

Using this equation we prove the claim \(\sum_{k=0}^{n}\left(\prod_{i=1}^{k}r_{i}\right)=\frac{1}{1+\mathbb{K}_{1}^{n}\frac{-r_{i}}{1+r_{i}}}\) by induction on the \( n\).

Taking \( x=1 \) in that equation, we obtain the \(n=1\) case, namely \(1+r_{1}=\frac{1}{1+\frac{-r_{1}}{1+r_{1}}}\).

Assuming for \(n-1\geq 1\) and proving for \(n\), we have

\(\sum_{k=0}^{n}\left(\prod_{i=1}^{k}r_{i}\right)=1+r_{1}\sum_{k=1}^{n}\left(\prod_{i=2}^{k}r_{i}\right)\overset{(1)}{=}1+r_{1}\frac{1}{1+\mathbb{K}_{2}^{n}\frac{-r_{i}}{1+r_{i}}}\overset{(2)}{=}\frac{1}{1+\frac{-r_{1}}{1+r_{1}+\mathbb{K}_{2}^{n}\frac{-r_{i}}{1+r_{i}}}} \) ,

where (1) follows from the induction step (there are only \( n-1 \) terms in the sum \(\sum_{k=1}^{n}\left(\prod_{i=2}^{k}r_{i}\right)\) above), and (2) follows from the equation above where we take \( x = 1 +\mathbb{K}_{2}^{n}\frac{-r_{i}}{1+r_{i}}\) and \( r = r_1 \). Finally, by the definition of the generalized continued fraction, we get

\(\frac{-r_{1}} { 1+r_{1}+\mathbb{K}_{2}^{n} \frac{-r_{i}} {1+r_{i}} } =\mathbb{K}_{1}^{n} \frac{-r_{i}} {1+r_{i}} \) ,

which completes the proof. ■


Example: The exponent function

The main example for Euler’s formula, is with the constant \( e \). Taking \( r_k = \frac{x}{k} \) we get that

\( e^x = \sum_{n=0}^\infty \frac{x^n}{n!} = \sum_{n=0}^\infty \prod_{k=1}^n r_k = \frac{1}{1+\mathbb{K}_{1}^{n}\frac{-r_{k}}{1+r_{k}}} = \frac{1}{1- \frac{x/1}{1+x/1 – \frac{x/2}{ 1+x/2 – \frac{x/3}{1+x/3 +\ddots}}}}\)

Since we would prefer to work with integers, and we have the simple equality \( \frac{x}{y+z} = \frac{cx}{cy+cz} \), we can use this product by scalar at each level, to get rid of the division by integers. This process is called the equivalence transformation , and more generally it says that

\( \mathbb{K}_1^\infty \frac{b_n}{a_n} = \frac{1}{c_0}\mathbb{K}_1^\infty \frac{c_{n-1}c_nb_n}{c_n a_n} \)

In the case above of the expansion of \( e \) it gives us

\(e^x = \frac{1}{1- \frac{x/1}{1+x/1 – \frac{x/2}{ 1+x/2 – \frac{x/3}{1+x/3 +\ddots}}}} = \frac{1}{1- \frac{1\cdot x/1}{1\cdot(1+x/1) – \frac{1\cdot2\cdot x/2}{ 2\cdot (1+x/2) – \frac{2\cdot 3\cdot x/3}{3\cdot(1+x/3) +\ddots}}}}= \frac{1}{1- \frac{x}{1+x – \frac{x}{ 2+x – \frac{2x}{3+x +\ddots}}}}=\frac{1}{1-\frac{x}{1+x+\mathbb{K}_1^\infty \frac{kx}{1+k+x}}}\)


While Euler’s formula + the equivalence transformation give us a way to move from sums to generalized (and many time polynomial) continued fractions, we can also try to use it on the other direction. Playing around with this idea, we are eventually led to the following:

Theorem (Euler’s family of continued fractions):

Suppose that we are given sequences \( a_n, b_n \) which satisfy

\( b_n = -h_1(n) h_2(n)\;\;\; ; \;\;\; a_n = h_1(n) + h_2(n+1) \).

for some functions \(h_1,h_2\). Then

\( \mathbb{K}_1^\infty \frac{b_n}{a_n} = h_2(1) (\frac{1}{ \sum_{k=0}^\infty \prod_{i=1}^{k} (\frac{h_1(i)}{h_2(i+1)}) } – 1) \)

or equivalently

\( \sum_{k=0}^\infty \prod_{i=1}^{k} (\frac{h_1(i)}{h_2(i+1)})= (\frac{1}{h_2(1)} \cdot \mathbb{K}_1^\infty \frac{b_n}{a_n} + 1)^{-1} \)

Remark: We create a python notebook where you can simply check for given polynomials \(a(x), b(x)\) if there are such \(h_1(x), h_2(x)\) and \(f(x)\).

Proof (press to see):



We first note that in Euler’s formula, the resulting continued fraction \( \mathbb{K}_1^\infty \frac{\tilde{b}_n}{\tilde{a}_n} \) satisfies \( \tilde{b}_n = -r_n, \; \tilde{a}_n = 1+r_n \), or in other words \( \tilde{a}_n + \tilde{b}_n = 1 \). This is not true in the case of this theorem, but we can fix it using the equivalence transformation with \( c_n = \frac{1}{h_2(n+1)}\). More precisely, using it we get that:

\( \mathbb{K}_1^\infty\frac{b_n}{a_n} = h_2(1) \mathbb{K}_1^\infty \frac{\frac{1}{h_2(n)h_2(n+1)}b_n}{\frac{1}{h_2(n+1)} a_n} \)

Now, by the assumption on \( a_n, b_n \) we get that

\( \frac{1}{h_2(n+1)} a_n + \frac{1}{h_2(n)h_2(n+1)}b_n = \frac{(h_1(n) + h_2(n+1))}{h_2(n+1)} – \frac{h_1(n)}{h_2(n+1)} = 1\).

We can now use Euler’s formula to find the infinite sum presentation. Taking

\( r_n = c_{n-1}c_n b_n = – \frac{1}{h_2(n)\cdot h_2(n+1)}(-h_1(n)\cdot h_2(n)) = \frac{h_1(n)}{h_2(n+1)}\)

we get

\((\frac{1}{h_2(1)}\mathbb{K}_1^\infty\frac{b_n}{a_n} + 1)^{-1} =(\mathbb{K}_1^\infty\frac{-r_n}{1+r_n} + 1)^{-1} = \sum_{n=0}^\infty \prod_{k=1}^n r_k =\sum_{n=0}^\infty \prod_{k=1}^n\frac{h_1(k)}{h_2(k+1)} \)■


Examples:

We consider the following examples with \( b_n = – h_1(n) \times h_2(n),\; \; a_n =h_1(n) + h_2(n+1) \), and we denote by \( P_n = \prod_1^n \frac{h_1(i)}{h_2(i+1)} \). With this notation, we get that \( \mathbb{K}_1^\infty \frac{b_n}{a_n} = h_2(1)((\sum_0^\infty P_n)^{-1}-1)\):

  1. If \( \deg(h_1)>\deg(h_2) \) or they have the same degree and the leading coefficient of \( h_1(x) \) is larger than that of \( h_2(x) \), then \( \lim_{i\to \infty} |\frac{h_1(i)}{h_2(i+1)}|>1\). Assuming that \( h_1(i), h_2(i+1)\neq 0\) for \( i\geq 1\), we get that the limit of the continued fraction is simply \( -h_2(1) \).
  2. Let \( h_1(n) = 1, \; h_2(n) = n \). We then have \( P_n = \frac{1}{(n+1)!} \), so that
    \( \mathbb{K}_1^\infty \frac{-n}{n+2} = \frac{1}{\sum_0^\infty \frac{1}{(n+1)!} } -1 = \frac{1}{e-1} – 1 \).
  3. For some \( d\geq 2\), let \( h_1(n)=h_2(n)=n^d\). We then have \( P_n = \frac{1}{(n+1)^d} \), so that
    \( \mathbb{K}_1^\infty \frac{-n^{2d}}{n^d + (n+1)^d} = \frac{1}{\sum_0^\infty \frac{1}{(n+1)^d} } -1 = \frac{1}{\zeta(d)} – 1 \).
  4. For some \( d\geq 3\), let \( h_1(n)=n^{d-1}(n+2) , \; h_2(n)=n^d\). We then have \( P_n = \frac{1}{(n+1)^{d-1}}\frac{n+2}{2} = \frac{1}{2}(\frac{1}{(n+1)^{d-1}} + \frac{1}{(n+1)^{d-2}}) \), so that
    \( \mathbb{K}_1^\infty \frac{-n^{2d-1}(n+2)}{n^{d-1}(n+2) + (n+1)^d} = \frac{1}{\frac{1}{2}(\zeta(d-1)+\zeta(d-2)) } -1\).
    A similar process can be done by adding \( m \) instead of \( 2 \).
  5. For some \( d\geq 2\), let \( h_1(n)=n^d ,\; h_2(n) = n^{d-1}(n+1)\). We then have \( P_n = \frac{1}{(n+1)^d}\frac{2}{n+2} \). Since \( \frac{1}{(j+1)(j+2)} = \frac{1}{j+1} – \frac{1}{j+2} \) we can show that \( P_n = \sum _{\ell=2}^{d} \frac{(-1)^{d-\ell}}{(n+1)^\ell} + (-1)^{d-1} (\frac{1}{n+1} – \frac{1}{n+2})\).
    It now follows that
    \( \sum_0^\infty P_n = \sum_{\ell=2}^d (-1)^{d-\ell} \zeta(\ell) + (-1)^{d-1}\).
    Again, a similar process can be done by adding \( m \) instead of \( 1 \).

These examples can be generalized to other \( h_1, h_2 \) which are polynomial over the integers with negative integer roots. Namely move from the polynomial continued fraction to an infinite sum, turn the product into a rational function and decompose it to simple rational functions, or if you have factorial in the denominator, look for a Taylor expansion.

One more generalization

This \( h_1, h_2 \) family can be slightly generalized. Indeed, given a function \( f(n) \) such that:

\( b_n = -h_1(n) \times h_2(n) \; \; ; \; \; f(n)a_n = f(n-1)h_1(n) + f(n+1) h_2(n+1) \)

then setting \( \tilde{h}_1 = f(n-1)h_1(n)\;,\;\; \tilde{h}_2(n)=h_2(n)f(n) \), we can use the equivalence transformation to get

\( \mathbb{K}_1^\infty \frac{b_n}{a_n} = \frac{1}{f(0)}\mathbb{K}_1^\infty \frac{f(n-1)f(n)b_n}{f(n)a_n} = \frac{1}{f(0)}\mathbb{K}_1^\infty \frac{-\tilde{h}_1(n)\tilde{h}_2(n)}{\tilde{h}_1(n) + \tilde{h}_2(n+1)} \)

which has the same form as the original family from above.

For example, take \( b_n = -n\; , \; a_n = n+3 \). The only polynomial decomposition of \( -b_n \) is with \( \{h_1(n), h_2(n)\}=\{1,n\} \), and in both cases we don’t have that \( a_n = h_1(n) + h_2(n+1) \). However, taking \( f(n)=n \) we get that

\( f(n)a_n = n(n+3) = (n-1) + (n+1)(n+1) = f(n-1)h_1(n) + f(n+1)h_2(n+1) \).

So while this polynomial continued fraction doesn’t have the \( h_1, h_2 \) form, it can be transformed into one.

Back to the mathematics of polynomial continued fractions.