An Egyptian fraction expresses a nonnegative rational number as a finite sum of positive unit fractions. A computational representation may permit repeated denominators, while the classical distinct-denominator convention adds a further requirement. The empty sum represents zero. For example, ; each denominator is a positive integer. A representation that permits repetition also has the simple expansion for nonnegative integers and positive .
For a positive proper residual fraction , with , choose , append the unit fraction , and replace the residual by in lowest terms. This is a greedy algorithm: the chosen unit fraction is the largest one not exceeding the residual.
The inequalities imply . Thus the numerator of the reduced residual strictly decreases while positive, proving algorithm termination by a nonnegative-integer loop variant. The loop invariant is that the accumulated sum plus the residual is the original rational number. Since and , the new residual is less than . If it remains positive, its next chosen denominator is therefore strictly greater than ; this expansion also satisfies the distinct-denominator convention. The proof does not bound the denominators by the input's fixed-width range. Arbitrary-precision arithmetic, checked conversion, or a different representable expansion can therefore be necessary in code.