Simple continued fraction
A (simple) continued fraction for a real number
where
where there are defined by the recurrence relations
Sage
The methods
.pand.qcorrespond to the notation given aboveK.<α> = QuadraticField(223) continued_fraction(α) # [14; (1, 13, 1, 28)*] continued_fraction(α).p(1) # 209 continued_fraction(α).q(1) # 14 continued_fraction(α).convergent(2) # 209/14