The calculator below represents a given rational number as a finite continued fraction. It also shows the continued fraction coefficients (first coefficient is the integer part). Read more on continued fractions just below the calculator.
Continued (recurring) fraction
Continued or recurring fraction is a number representation kind as a sum of the number integer part and the fractional part. The fractional part numerator is always one, the denominator is the sum of the integer part and the fractional part. The fractional part denominator may again contain the sum of integer and fractional part and so on.
a0,a1,a2...an is the continued fraction coefficients.
We use the following algorithm to calculate continued fraction coefficients:
// n - the fraction numerator // d - the fraction denominator loop while d ≠ 0 r ⟵ n mod d; output ⟵ (n-r)/d; n ⟵ d; d ⟵ r; end loop