A unit fraction is for a positive integer . Its numerator is one, so it is already a reduced fraction; the denominator determines its value uniquely. For example, and are unit fractions, while is not.
Every unit fraction lies in , including . A rational number can have several expressions as a sum of unit fractions: , for example. An Egyptian fraction requires such a finite representation, usually with distinct denominators.
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.

Articles by others on the same topic (1)

A unit fraction is a fraction where the numerator is 1 and the denominator is a positive integer. In other words, it can be expressed in the form \( \frac{1}{n} \), where \( n \) is a positive integer. For example, \( \frac{1}{2} \), \( \frac{1}{3} \), and \( \frac{1}{4} \) are all unit fractions.