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 = \sqbrk {a_0, a_1, a_2, \ldots}$ is the required continued fraction expansion.