Continued fraction with different numerators [duplicate]

This question already has an answer here:

Building a continued fraction

6 answers

In Mathematica, is it possible to form the continued fraction of the following formula?
f=a1+b1a1+a2+b2a2+a3+b3a3+a4+b4a4+… f = a_1+\cfrac{b_1}{a_1+a_2+\cfrac{b_2}{a_2+a_3+\cfrac{b_3}{a_3+a_4+\cfrac{b_4}{a_4+…}}}}

=================

=================

1 Answer
1

=================

Well, it is really simple with Fold

Fold[a[#2] + b[#2]/(a[#2] + #1) &, 0, Reverse[Range[6]]]

  

 

For the updated question, I think you only have to modify this as Fold[a[#2] + b[#2]/(a[#2] + #1) &, (Range[10]~Join~{0}) // Reverse], I put the 0 in there so it doesn’t have a constant in the terminal fraction.
– JasonB
Jan 6 at 8:20

  

 

@JasonB That’s what I want. Thanks 🙂
– Tony Dong
Jan 6 at 8:25