Simple continued fraction
A (simple) continued fraction for a real number
where
where there are defined by the recurrence relations
Sage
The methods .p and .q correspond to the notation given above
K.<α> = 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
#state/develop | #lang/en | #SemBr