Fibonacci's Greedy Algorithm

Algorithm
Let $\dfrac p q$ denote a proper fraction expressed in canonical form.

Fibonacci's greedy algorithm is a greedy algorithm which calculates a sequence of distinct unit fractions which together sum to $\dfrac p q$:

Fibonacci's Greedy Algorithm is as follows:


 * $(1) \quad$ Let $p = x_0$ and $q = y_0$ and set $k = 0$.


 * $(2) \quad$ Is $x_k = 1$? If so, the algorithm has finished.


 * $(3) \quad$ Find the largest unit fraction $\dfrac 1 {m_k}$ less than $\dfrac {x_k} {y_k}$.


 * $(4) \quad$ Calculate $\dfrac {x_{k + 1} } {y_{k + 1} } = \dfrac {x_k} {y_k} - \dfrac 1 {m_k}$ expressed in canonical form.


 * $(5) \quad$ Go to step $(2)$.

Also see

 * Proper Fraction can be Expressed as Finite Sum of Unit Fractions/Fibonacci's Greedy Algorithm, which proves that Fibonacci's Greedy Algorithm works as expected