Calculating the simple continued fraction of logba/d

Here a > d > 1, are integers, as is b > 1.
This performs an algorithm based on a paper of T.H. Jackson and K.R. Matthews, On Shanks' algorithm for computing the continued fraction of logba, Journal of Integer Sequences 5 (2002) article 02.2.7.
Our algorithm is described in the altered version of that paper.

We run the algorithm for c = brd, r = m,...,n (suggested by Alan Offer).
Here a, b, m, n are positive integers satisfying a > b > 1, and 1 ≤ m ≤ n.

In version 1, we employ the criterion Ai,c > c + b√c in the main loop and usually correct partial quotients are returned.
However the example (a,d,b,m,n)=(991,1,2,146,148) shows that there are exceptions.

In version 2, we use the stronger cutoff condition Ai,c > c + b2√c in the main loop, and this anomaly disappears.
However fewer partial quotients will be returned compared with version 1.

We want a > d ≥ 1 and b > 1.

Enter a:
Enter d:
Enter b:
Enter m:
Enter n ≥ m:
version 1
version 2

Last modified 8th August 2019
Return to main page