Algosim documentation: ContinuedFraction

ContinuedFraction

Computes the continued fraction representation of a number.

Syntax

Description

ContinuedFraction(x, n) returns the continued fraction representation of x as a list of integers with length at most n. If omitted, n defaults to 18.

ContinuedFraction(π)
3  7  15  1  292  1  1  1  2  1  3  1  14  2  1  1  2  2
ContinuedFraction(613/617513)
0  1007  2  1  3  5  3  3
ContinuedFraction(17875057260063841/6305034377045117, 1000)
2  1  5  16  16  1  1  1  1  4  1  19  1  4  12  1  1  1  1  1  2  2  1  3  1  1

1  1  1  1  2  1  4  2  1  1  9  4  7

See also