Finding the continued fraction of el/m

The continued fraction expansions for e1/k and e2/k (k odd) are well known, namely:



However there is no known formula for the partial quotients of the continued fraction expansion of e3, or more generally el/m, with l distinct from 1,2 and gcd(l,m)=1.
We perform the algorithm of J.L. Davison, An algorithm for the continued fraction of el/m, Proceedings of the Eighth Manitoba Conference on Numerical Mathematics and Computing (Univ. Manitoba, Winnipeg, 1978), 169-179, Congress. Numer., XXII, Utilitas Math.

The starting point is a result of R.F.C. Walters in Alternate derivation of some regular continued fractions, J. Austr. Math. Soc 8 (1968), 205-212): If

then pn/rn and qn/snel/m.

We first find the least n=n* such that pn, qn, rn, sn are non-negative and repeatedly apply Raney's factorisation for n*≤ k ≤ n*+N, as in Davison's example in §3.
The number (count) of partial quotients of el/m found is returned.
We cannot predict the value of count, but it becomes positive for sufficiently large N.
We suggest taking l/m no greater than say 14, because of the time taken to compute a0.

This is a BCMATH translation of a BC program.
A faster C version is available.

Inside the program, l and m are replaced by l/gcd(l,m) and m/gcd(l,m).

Enter l (> 0):
Enter m (> 0):
Enter N (≥ 0):

Last modified 1st June 2006
Return to main page