Continued fraction
Output:
A more original and a bit more abstract method would consist in viewing a continued fraction on rank n as a function of a variable x:
Or, more consistently:
Viewed as such, C F n ( x ) {\displaystyle \mathrm {CF} _{n}(x)} could be written recursively:
Or in other words:
where f n ( x ) = a n + b n x {\displaystyle f_{n}(x)=a_{n}+{\frac {b_{n}}{x}}}
Raku has a builtin composition operator. We can use it with the triangular reduction metaoperator, and evaluate each resulting function at infinity (any value would do actually, but infinite makes it consistent with this particular task).
Output:
Last updated
Was this helpful?