### The optimal continued fraction algorithm for rationals

This is Wieb Bosma's OCF (optimal continued fraction) algorithm for a rational number.

See *Optimal continued fractions*, Wieb Bosma, Indag. Math. **49** (1987), 353-379.
Here we choose the nearest integer t=[p/q] to be z+1, if p/q=z+1/2.

e=1 prints the b_{k} and u_{k}/v_{k}.

*Last modified 4th April 2008*

Return to main page