Continued fraction

A continued fraction is a fraction of the form $a_1 + \cfrac{b_1}{ a_2 + \cfrac{b_2}{ a_3 + \cfrac{b_3}{a_4 + \dotsb}}}$ A simple continued fraction is one in which every $b_i$ is equal to $1$, and every $a_i$ is a positive integer (except that $a_1$ may be any integer).

Every rational number can be written as a terminating simple continued fraction.

Some numbers can be written as recurring simple continued fractions, for example $\sqrt{5} = 2 + \cfrac{1}{ 4 + \cfrac{1}{ 4 + \cfrac{1}{ 4 + \dotsb}}}$