Mathematics calculator

Egyptian Fraction Calculator

Decompose a positive proper fraction into a sum of distinct unit fractions using the greedy algorithm.

Calculator inputs

Enter your values

Unit-fraction decomposition
Enter numerator/denominator; the denominator may not exceed 100,000.
Calculated output

Result summary

Your result will appear here

Complete the required fields and select the calculate button.

What Is an Egyptian Fraction?

An Egyptian fraction writes a positive rational number as a sum of distinct unit fractions. Each unit fraction has numerator 1, such as 1/3 or 1/120, and no term repeats. For example, 7/15 = 1/3 + 1/8 + 1/120.

This Egyptian Fraction Calculator uses the greedy method for positive proper fractions, meaning fractions strictly between 0 and 1. It repeatedly selects the largest unit fraction no greater than the remaining amount. The output is exact when the calculation completes, but it is not guaranteed to use the fewest terms or the smallest denominators.

How to Convert a Fraction into Unit Fractions

  1. Keep Decomposition method set to Greedy algorithm. It is the only supported method.
  2. Enter a Positive proper fraction as numerator/denominator, such as 7/15. Spaces around the slash are accepted.
  3. Use positive integer terms with numerator smaller than denominator and denominator no greater than 100,000. Do not enter a decimal or mixed number.
  4. Select Calculate. Read the unit-fraction sum, original fraction, term count, method and verification statement.

The algorithm uses integer ceiling division to choose each unit denominator, subtracts that unit fraction exactly, reduces the remainder and repeats. It stops when the remainder is zero. An input such as 2/6 can return the single unit fraction 1/3 without changing the original-fraction reference.

Denominators can grow quickly. Some valid input fractions within the entry limit still exceed native integer capacity during the greedy expansion; the calculator then rejects the calculation rather than publish an unsafe result. A successful verification statement restates the equality from the computed terms. Use a common denominator for a separate mathematical check.

Greedy Egyptian Fraction Formula

For remainder p/q: choose u = ceil(q ÷ p)

Selected unit fraction = 1/u

New remainder = p/q − 1/u = (pu − q)/(qu)

Reduce the new numerator and denominator, then repeat

The ceiling makes 1/u the largest unit fraction that does not exceed p/q. Each subtraction leaves a nonnegative rational remainder. For a positive proper fraction, repeated greedy steps give increasing unit denominators, so the resulting unit fractions are distinct.

The UC Irvine Egyptian fractions resource explains distinct-unit representations and different construction methods. Ron Knott’s University of Surrey resource develops methods and examples for exploring them.

The mathematical greedy procedure terminates for positive rational input. That fact does not remove a computer’s finite integer limits. This implementation checks multiplication sizes and can stop with an error when intermediate denominators become too large.

Fraction Input and Decomposition Results

Decomposition method
Greedy algorithm only. The selector does not provide a shortest-expansion search.
Positive proper fraction p/q
Integer input with 0 < p < q and 2 ≤ q ≤ 100,000.
Egyptian fraction sum
Featured exact sum of distinct fractions with numerator 1, if the bounded calculation completes.
Original fraction
Parsed input fraction, not necessarily reduced in this reference card.
Number of unit fractions
Count of the returned terms, not a proof of minimum possible length.
Method
Names the greedy construction used for the result.
Verification
Restates the computed equality. Independently recombine terms if you need a separate proof.

Egyptian Fraction Worked Example

Illustrative example. Expand 7/15 using the greedy method. First choose u = ceil(15/7) = 3, giving 1/3. The remainder is 7/15 − 1/3 = 2/15.

Next choose u = ceil(15/2) = 8. Subtract 1/8 from 2/15 to obtain 1/120, which is already a unit fraction. The result is 1/3 + 1/8 + 1/120.

Verify independently with denominator 120: 40/120 + 15/120 + 1/120 = 56/120 = 7/15. There are 3 distinct unit fractions.

Calculation check. These illustrative values were checked independently against the formula and calculator response. Retain unrounded intermediate values when checking approximations.

Egyptian Fraction Worked Example
StageValue
Input7/15
First term; remainder1/3; 2/15
Second term; remainder1/8; 1/120
Final term1/120
Exact sum1/3 + 1/8 + 1/120

Different Exact Sums for the Same Fraction

An Egyptian fraction representation is not generally unique. These two sums both equal 7/15 and have distinct unit terms, but only the first is returned by this calculator’s greedy procedure.

Different Exact Sums for the Same Fraction
ConstructionExact sumCheck denominator
Greedy method here1/3 + 1/8 + 1/120(40 + 15 + 1)/120 = 7/15
Another valid representation1/3 + 1/10 + 1/30(10 + 3 + 1)/30 = 7/15

How to Verify a Unit Fraction Sum

Each displayed term has numerator one, and adding the terms exactly recovers the input fraction. The decomposition is valid even if it is not the shortest possible one. Greedy selection makes a local choice at each step; it does not search all possible representations for the fewest terms or smallest final denominator.

Different valid decompositions can therefore look very different. For example, 2/3 can be written as 1/2 + 1/6, while other longer representations also exist. Use a common denominator or exact rational arithmetic to verify an answer. Decimal approximations are useful for a quick check but may hide tiny rounding differences.

A single term is a valid result when the input reduces to a unit fraction. Distinct terms are required: 2/7 = 1/7 + 1/7 is an equality, but repeating 1/7 does not meet the distinct-unit convention used here.

Use exact rational addition to check small final terms. A decimal display may hide the last term entirely if its denominator is very large. This form does not accept zero, negative fractions, improper fractions or irrational numbers as input.

Common Egyptian Fraction Mistakes

  • Entering a decimal or mixed number instead of integer numerator/denominator text.
  • Using a zero numerator, zero denominator or fraction at least 1.
  • Repeating a unit fraction and calling the representation distinct.
  • Assuming the greedy expansion is the only valid representation or the shortest one.
  • Treating an integer-size rejection as proof that no Egyptian fraction representation exists.
  • Checking only a short decimal approximation when very small terms matter.

Frequently Asked Questions

What is an Egyptian fraction?

It is a sum of distinct positive unit fractions, each with numerator 1. For example, 7/15 = 1/3 + 1/8 + 1/120.

How does the greedy method choose a term?

For a remainder p/q, it chooses denominator ceil(q/p). That makes 1/u the largest unit fraction no greater than the remainder.

Can the same unit fraction appear twice?

Not under the distinct-unit convention used here. Although 1/7 + 1/7 = 2/7, that repeated-term sum is not the required Egyptian representation.

Must I simplify the input fraction first?

No. For example, 2/6 can return 1/3. The calculator reduces remainders during its construction, while the original-input card can retain the unreduced fraction.

Can I enter zero, a negative or an improper fraction?

No. The form accepts positive proper fractions with integer numerator and denominator, where 0 < numerator < denominator ≤ 100,000.

Does greedy always give the shortest expansion?

No. It makes a local largest-unit choice and does not search every representation for the fewest terms or smallest final denominator.

Why can a valid fraction fail to calculate?

Greedy denominators can grow beyond the implementation’s safe integer range. Such a rejection does not mean no Egyptian fraction expansion exists.

How do I verify the final sum?

Convert the returned unit fractions to a common denominator and add exactly. For 1/3 + 1/8 + 1/120, the result is 56/120 = 7/15.

Sources and References