Continued Fraction Algorithm

Algorithm
The Continued Fraction Algorithm is a method for finding the continued fraction expansion for any irrational number to as many partial quotients as desired.

Let $x_0$ be the irrational number in question.

The steps are:

Then $x_0 = \left[{a_0, a_1, a_2, \ldots}\right]$ is the required continued fraction expansion.