Continued fractions in Sage
Continued fractions - Diophantine approximation | Sage Reference Manual
continued_fraction(sqrt(2))
[1; 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ...]
continued_fraction(sqrt(3))
[1; 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, ...]
continued_fraction(sqrt(5))
[2; 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, ...]
continued_fraction(sqrt(6))
[2; 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, ...]
continued_fraction(sqrt(7))
[2; 1, 1, 1, 4, 1, 1, 1, 4, 1, 1, 1, 4, 1, 1, 1, 4, 1, 1, 1, ...]
continued_fraction(sqrt(8))
[2; 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, 4, 1, ...]
continued_fraction(sqrt(10))
[3; 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, ...]
continued_fraction(sqrt(11))
[3; 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, ...]
continued_fraction(sqrt(12))
[3; 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, 6, 2, ...]
continued_fraction(sqrt(13))
[3; 1, 1, 1, 1, 6, 1, 1, 1, 1, 6, 1, 1, 1, 1, 6, 1, 1, 1, 1, ...]
continued_fraction(sqrt(14))
[3; 1, 2, 1, 6, 1, 2, 1, 6, 1, 2, 1, 6, 1, 2, 1, 6, 1, 2, 1, ...]
continued_fraction(sqrt(15))
[3; 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, ...]
continued_fraction(sqrt(17))
[4; 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, ...]
continued_fraction(sqrt(18))
[4; 4, 8, 4, 8, 4, 8, 4, 8, 4, 8, 4, 8, 4, 8, 4, 8, 4, 8, 4, ...]
continued_fraction(sqrt(19))
[4; 2, 1, 3, 1, 2, 8, 2, 1, 3, 1, 2, 8, 2, 1, 3, 1, 2, 8, 2, ...]
continued_fraction(sqrt(20))
[4; 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2, 8, 2, ...]
continued_fraction(sqrt(21))
[4; 1, 1, 2, 1, 1, 8, 1, 1, 2, 1, 1, 8, 1, 1, 2, 1, 1, 8, 1, ...]
continued_fraction(sqrt(22))
[4; 1, 2, 4, 2, 1, 8, 1, 2, 4, 2, 1, 8, 1, 2, 4, 2, 1, 8, 1, ...]
continued_fraction(sqrt(23))
[4; 1, 3, 1, 8, 1, 3, 1, 8, 1, 3, 1, 8, 1, 3, 1, 8, 1, 3, 1, ...]
continued_fraction((1+sqrt(5))/2)
[1; 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...]
continued_fraction((1+sqrt(13))/2)
[2; 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, ...]
continued_fraction((1+sqrt(17))/2)
[2; 1, 1, 3, 1, 1, 3, 1, 1, 3, 1, 1, 3, 1, 1, 3, 1, 1, 3, 1, ...]