Egyptian Fraction Generator
The ancient Egyptians wrote every fraction as a sum of distinct unit fractions, and Fibonacci later proved a greedy method always works: take the largest unit fraction that fits, and repeat. It terminates, but the denominators can grow so fast that ordinary decimal arithmetic stops adding up within a few terms. This does the whole calculation in exact big integers, and adds the result back up to prove it.
What this generator does
Repeatedly subtracts the largest unit fraction that still fits, using exact big-integer arithmetic throughout, and then adds the resulting unit fractions back up and compares them with the original fraction.
How to use this tool
- Enter a fraction, such as 5 over 121.
- Read the unit fractions the greedy method produces.
- Watch how quickly the denominators grow.
- Try 5 over 121 to see the classic example of that explosion.
Understanding the controls
- Numerator and denominator
- Any fraction up to four digits each. The numerator drives the number of terms: greedy expansion of n/d takes at most n steps, but each step can square the denominator.
Common use cases
- Working through Egyptian fraction expansions with exact answers
- Showing why greedy algorithms can terminate and still behave badly
- Teaching unit fractions with a historical framing
- Producing worked examples for a number theory exercise
- Demonstrating where ordinary floating-point arithmetic would fail
How this generator works
The largest unit fraction not exceeding n/d is one over the ceiling of d divided by n. Subtracting it leaves a fraction with a strictly smaller numerator, which is why the process always terminates. The denominators, however, roughly square each step, so the arithmetic is done in big integers — with ordinary numbers the sum silently stops matching after four or five terms. Before display the unit fractions are added back up exactly and compared with the original, and an expansion cut short is labelled as incomplete rather than shown as if it were finished.
Randomness and fairness
Nothing here is random. The greedy expansion of a fraction is unique.
For how randomness is produced across the whole site, see how Generate Random works.
Limitations and good to know
- Greedy is not shortest: many fractions have a two-term expansion that greedy misses entirely in favour of a longer one.
- Expansions are cut off after ten terms, and say so — a few inputs would otherwise produce denominators hundreds of digits long.
- Only positive fractions are handled, since unit fractions are positive by definition.
- The historical Egyptian system had special notation for 2/3 that this does not reproduce.
Privacy and your data
The expansion is computed in your browser and the fraction you enter is never transmitted, stored or included in analytics.
Related generators
- Continued Fraction GeneratorExpands any fraction into its continued fraction and lists the convergents, each proved to be the best approximation for its denominator.
- Best Rational Approximation GeneratorFinds the closest fraction to a decimal within a denominator limit, proved by testing every denominator up to that limit.
- Farey Sequence GeneratorLists every fraction between 0 and 1 with a bounded denominator, in order, with the neighbour identity checked on every consecutive pair.
- Fraction Question GeneratorFraction questions built to order — a fraction of an amount, simplifying, adding with the same or different denominators, and multiplying.