Formula and Method for the Egyptian Fraction Calculator
An Egyptian fraction is a way of writing a positive rational number as a sum of distinct unit fractions — fractions with a numerator of 1, such as 1/2, 1/3, or 1/15 — with no denominator repeated. The method dates back to the Rhind Mathematical Papyrus (c. 1650 BCE), where ancient Egyptian scribes recorded fractions almost exclusively this way. This calculator takes a fraction n/d and expands it into a sum of distinct unit fractions using the greedy algorithm, also called the Fibonacci–Sylvester algorithm after Leonardo Fibonacci, who proved in his 1202 book Liber Abaci that it always produces a finite expansion.
How the greedy algorithm works
Starting from a proper fraction n/d (with 0 < n < d), the greedy method repeatedly subtracts the largest unit fraction that does not exceed what remains. At each step it takes the unit fraction 1/⌈d/n⌉, where ⌈d/n⌉ is d divided by n rounded up to the next whole number, and subtracts it from the current remainder. For example, 5/6 becomes 1/2 first (since ⌈6/5⌉ = 2, because 6/5 = 1.2); subtracting leaves 5/6 − 1/2 = 1/3, which is already a unit fraction, so 5/6 = 1/2 + 1/3. Because the numerator of the remainder is always smaller after each step, the process is guaranteed to terminate. If the input fraction is improper (numerator ≥ denominator), the calculator first separates out the whole-number part and expands only the proper-fraction remainder.
Common mistakes
- Repeating a denominator: 1/3 + 1/3 is not a valid Egyptian fraction — denominators must all be distinct; use 2/3 = 1/2 + 1/6 instead.
- Assuming the expansion is unique: the greedy algorithm produces one valid decomposition, but the same fraction can often be written with fewer terms or smaller denominators using other methods.
- Flipping the ratio: the step formula is ⌈d/n⌉ (denominator over numerator), not ⌈n/d⌉ — mixing these up gives a fraction greater than 1 instead of a valid unit fraction.
Why denominators can grow so fast
Because each step's denominator depends on the previous remainder, fractions close to 1 — such as 2/3 or 4/5 — can produce rapidly growing denominators under the greedy method, a pattern related to Sylvester's sequence (2, 3, 7, 43, 1807, ...). This calculator caps the number of terms it will compute so an extremely fast-growing expansion doesn't stall your browser; if a result is marked as truncated, try raising the maximum terms slightly, or note that the greedy method is not always the most practical representation for that fraction.