In mathematics, the greedy algorithm for Egyptian fractions is a greedy algorithm, first described by Fibonacci, for transforming rational numbers into Egyptian fractions. An Egyptian fraction is a representation of an irreducible fraction as a sum of distinct unit fractions, such as 5/6 = 1/2 + 1/3. As the name indicates, these representations have been used as long ago as ancient Egypt, but the first published systematic method for constructing such expansions was described in 1202 in the Liber Abaci of Leonardo of Pisa (Fibonacci).[1] It is called a greedy algorithm because at each step the algorithm chooses greedily the largest possible unit fraction that can be used in any representation of the remaining fraction.
Fibonacci actually lists several different methods for constructing Egyptian fraction representations.[2] He includes the greedy method as a last resort for situations when several simpler methods fail; see Egyptian fraction for a more detailed listing of these methods. The greedy method, and extensions of it for the approximation of irrational numbers, have been rediscovered several times by modern mathematicians,[3] earliest and most notably by J. J. Sylvester (1880)[4] A closely related expansion method that produces closer approximations at each step by allowing some unit fractions in the sum to be negative dates back to Lambert (1770).
The expansion produced by this method for a number is called the greedy Egyptian expansion, Sylvester expansion, or Fibonacci–Sylvester expansion of . However, the term Fibonacci expansion usually refers, not to this method, but to representation of integers as sums of Fibonacci numbers.