### Continued fraction BCMATH programs

- Euclid's algorithm and the regular continued fraction expansion of a rational number.
- The optimal continued fraction (OCF) expansion of a rational number.
- Nearest integer version of Euclid's algorithm.
- Calculating the fraction represented by the simple continued fraction a
_{0}+1/a_{1}+ ··· +1/a_{n}.
- Finding the backward continued fraction of a quadratic irrational.
- Finding the simple continued fraction of a quadratic irrational.
- Finding the simple continued fraction of √d over a range of consecutive d.
- Finding the period-length of the simple continued fraction of √d using midpoint criteria.
- Finding the positive and negative representations of a quadratic surd, as far as the end of the first period.
- Testing a quadratic surd for being RCF-reduced.

- Finding the nearest integer continued fraction (NICF-H) of a quadratic irrational.
- Finding the nearest integer continued fraction (NICF-P)
- Finding the optimal continued fraction of a quadratic irrational.
- Finding the optimal continued fraction of √d over a range of consecutive d.

- Finding the nearest square continued fraction of a quadratic irrational.
- Finding the nearest square continued fraction of √d over a range of consecutive d.
- Testing a quadratic surd for being NSCF-reduced.
- Testing a quadratic surd for being NSCF-reduced. This is more elegant than the previous test.

- Solving the Pell equation x
^{2} – dy^{2} = ±1 using midpoint criteria,
- Solving the diophantine equation x
^{2} – xy – (D – 1)y^{2}/4 = ±1, using the nearest square continued fraction of (1+√D)/2, D ≡ 1(mod 4).
- Calculating the quadratic irrationality whose periodic simple continued fraction is given.
- Producing a quadratic surd equivalent to a given one.
- Finding the simple continued fraction of
- Finding a Sturm sequence for a squarefree polynomial.
- Factorising
- Guessing the simple continued fraction expansion of log
_{b}a (algorithm 4).
- Finding the simple continued fraction of
*e*^{p/q}.
- Finding the simple continued fraction of
*(m/n)e*^{1/q}.

*Last modified 19th November 2018*

Return to main page