= Solution
For $m>0$, $1/q\leq m/n$ is equivalent to $q\geq n/m$. The largest allowed <unit fraction> therefore has the smallest such integer denominator:
$$
\boxed{q=\left\lceil\frac nm\right\rceil.}
$$
The residual is $(mq-n)/(nq)$. From $(q-1)m<n\leq qm$ we obtain
$$
\boxed{0\leq mq-n<m.}
$$
Thus the nonnegative numerator strictly decreases at each nonfinal step, and reduction to lowest terms can only decrease it further. This <loop variant> proves termination of the <greedy Egyptian fraction expansion>. The case $m=0$ already has the empty expansion and requires no division by $m$.
Back to article page