Egyptian Fraction Calculator: How It Works
The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.
An Egyptian fraction calculator takes any positive rational number (like 3/7 or 5.25) and rewrites it as a sum of distinct unit fractions—fractions with numerator 1, such as 1/2 + 1/7 + 1/14. You enter a fraction or decimal, and the calculator returns a list of unit fractions that add up exactly to your input. It’s a practical tool for anyone studying number theory, history of mathematics, or just curious about how ancient Egyptians represented non-integer quantities.
Formula
The most common method is the greedy algorithm (also called the Fibonacci–Sylvester algorithm). For a fraction a/b (where a < b and a > 0):
- Find the smallest unit fraction less than or equal to a/b. That is the ceiling of b/a, written as ⌈b/a⌉. Its reciprocal is 1/⌈b/a⌉.
- Subtract that unit fraction from a/b to get a new fraction.
- Repeat until the remainder is 0.
In symbols, if you have a/b, the next unit fraction is 1/⌈b/a⌉, and the new fraction is a/b − 1/⌈b/a⌉. The process always terminates, but the number of terms can be large.
Worked Example
Using the default input 3/7:
- ⌈7/3⌉ = 3, so the first term is 1/3.
- 3/7 − 1/3 = (9−7)/21 = 2/21.
- ⌈21/2⌉ = 11, so the next term is 1/11.
- 2/21 − 1/11 = (22−21)/231 = 1/231.
- ⌈231/1⌉ = 231, so the last term is 1/231.
Result: 3/7 = 1/3 + 1/11 + 1/231. The calculator shows this as “1/3 + 1/11 + 1/231�.
Background: Why Egyptian Fractions?
Ancient Egyptian mathematics (documented in the Rhind Papyrus, circa 1650 BCE) used unit fractions for nearly all fractional quantities. They wrote 2/3 as a special symbol and expressed other fractions as sums of distinct unit fractions. For example, 2/5 was written as 1/3 + 1/15. This system avoided the need for a general numerator, making arithmetic more cumbersome but still functional. Modern interest comes from number theory: every positive rational has infinitely many such representations, and the greedy algorithm gives one canonical form.
How to Choose a Method
While the greedy algorithm is standard, other methods exist:
- Greedy (Fibonacci–Sylvester): Always picks the largest possible unit fraction. It terminates but may produce many terms or large denominators (e.g., 5/121 becomes 1/25 + 1/757 + 1/763309 + 1/873960180913 + 1/1527612795642093418846225).
- Binary splitting: Uses powers of 2, not always exact.
- Odd greedy: Restricts denominators to odd numbers, but it is an open problem whether it always terminates.
- Shortest representation: Finds the fewest terms, but requires a search and is not practical by hand.
For most purposes, the greedy algorithm is best because it is simple, guaranteed to finish, and gives a unique answer.
Common Problems and Mistakes
- Inputting a decimal: If you enter 0.75, the calculator converts it to 3/4 first. But if you enter a repeating decimal like 0.333…, you should use the fraction 1/3 instead of rounding.
- Forgetting that unit fractions must be distinct: 1/2 + 1/2 is not allowed; you must combine them or use a different representation.
- Using a numerator larger than the denominator: For improper fractions like 5/3, the greedy algorithm works but gives terms that sum to more than 1. Some calculators first separate the integer part: 5/3 = 1 + 2/3, then 2/3 = 1/2 + 1/6.
- Rounding errors: If you round intermediate results, you may get a sum that is not exactly equal. The calculator uses exact integer arithmetic internally.
Limits of the Greedy Algorithm
The greedy algorithm is not always the most elegant. For 5/121 it produces five terms with enormous denominators, while a shorter representation exists: 1/33 + 1/121 + 1/363. Also, the number of terms can grow quickly; for some fractions it is exponential in the number of digits. There is no known formula for the minimum number of terms, and finding the shortest representation is computationally hard (NP-hard in some formulations).
Alternatives and Related Calculators
If you need a different representation, you can use:
- Continued fraction calculator: Gives a different kind of decomposition.
- Fraction simplifier: Reduces to lowest terms but does not split into unit fractions.
- Decimal to fraction converter: Converts a decimal to a common fraction, which you can then feed into this calculator.
For historical purposes, you might also want to see the “2/n table� from the Rhind Papyrus, which lists specific decompositions for 2 divided by odd numbers from 3 to 101.
Frequently Asked Questions
What is an Egyptian fraction?
An Egyptian fraction is a sum of distinct unit fractions (1/n) where each denominator is a positive integer and no denominator repeats. For example, 3/7 = 1/3 + 1/11 + 1/231.
Does every fraction have an Egyptian fraction representation?
Yes. Every positive rational number can be expressed as a sum of distinct unit fractions. This was proven in the 19th century, and the greedy algorithm provides a constructive proof.
Why are they called Egyptian?
Because they appear in ancient Egyptian mathematical texts, most notably the Rhind Papyrus. The Egyptians used unit fractions for most fractional calculations, with only a few exceptions like 2/3.
Is the greedy algorithm the only way?
No. There are many ways to represent a fraction as Egyptian fractions. The greedy algorithm gives one canonical result, but you can also find shorter or more aesthetically pleasing representations by other methods.
Can I use this calculator for improper fractions?
Yes, but the calculator will treat the numerator and denominator as given. For 5/3, the greedy algorithm gives 1/1 + 1/2 + 1/6, which is valid because 1/1 is a unit fraction. If you prefer to separate the whole number, you can do that manually first.
Why do some results have huge denominators?
Because the greedy algorithm always picks the largest possible unit fraction, which can lead to rapid growth in denominators, especially for fractions with large numerators or denominators. This is a known characteristic and is not a bug.
Related
Formula used
in n | Numerator | - | 3 | 0 in d | Denominator | - | 7 | 1 out egypt | Egyptian fraction | - | greedy(n, d) | 0
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.