Advertisement
Advertisement
NUMBER THEORY

Egyptian Fraction Calculator — a sum of distinct unit fractions

Enter any fraction and get its greedy Egyptian expansion, term by term, with exact big-integer arithmetic and a check that the unit fractions add back to what you started with.

Whole numbers only. Negatives are allowed; the sign is carried outside the expansion.
Must not be zero. The fraction is reduced to lowest terms before the algorithm starts.
A safety limit. The greedy method always terminates, but denominators can grow past a thousand digits within a handful of steps.
Prevents an unreadable wall of digits. If the limit stops the run, the remaining fraction is reported instead.
Egyptian expansion
 
Unit fractions used
Reduced fraction
Digits in the last denominator
Sums back exactly?
Step by step:
Verification:
Tip: the greedy method guarantees a valid answer but not the shortest one. It expands 5/121 into five terms ending in a twenty-five-digit denominator, while 1/33 + 1/121 + 1/363 does the same job in three. Shortness is a much harder problem.
Advertisement

The Egyptian fraction calculator above rewrites any fraction as a sum of distinct unit fractions — fractions with a numerator of one and no denominator repeated. It uses the greedy method, works entirely in exact big-integer arithmetic so nothing is lost to rounding, prints every subtraction step, and verifies that the terms sum back to the original fraction precisely rather than approximately.

This is a distinct job from ordinary fraction arithmetic. Arb Digital's fraction calculator adds, subtracts, multiplies and divides fractions; our simplify fractions calculator reduces one to lowest terms. This page does neither. It decomposes a single fraction into a specific, historically motivated form that no ordinary calculator produces.

What This Egyptian Fraction Calculator Does

It reduces your fraction to lowest terms, then applies the greedy algorithm: repeatedly subtract the largest unit fraction that does not exceed what remains, until nothing is left. Every step is exact. The tool uses arbitrary-precision integers throughout, because the denominators produced by this method grow explosively and double-precision arithmetic silently fails after a handful of steps.

Two safety limits are exposed rather than hidden. The first caps the number of terms; the second caps the number of digits in a denominator. Either can stop the run, and when one does, the tool reports the fraction still outstanding rather than pretending the expansion finished. That is important, because the greedy method genuinely does terminate for every positive fraction — the limits are about readability, not about the algorithm giving up.

For fractions greater than one, the whole-number part is peeled off first and shown separately. A sum of distinct unit fractions cannot exceed a certain size for a given number of terms, and repeating 1/1 would break distinctness, so this is the standard convention rather than a shortcut.

The verification panel recombines the unit fractions over a common denominator in exact arithmetic and compares the result with the reduced input. It either matches exactly or it does not, and the tool says which. On a page about exactness, an approximate check would be beside the point.

How to Use It

  1. Enter the numerator and denominator. Any whole numbers; the fraction is reduced before anything else happens.
  2. Read the expansion in the hero, written as a sum of unit fractions in increasing denominator order.
  3. Follow the step panel to see the remaining fraction after each subtraction, which is where the growth becomes visible.
  4. Raise the digit limit if a run stops early and you want to see how far the denominators actually go.
  5. Confirm the verification line says the terms sum back exactly. That is the only check that matters.

The Formula and How It Is Calculated

The greedy method, also called the Fibonacci–Sylvester algorithm, is stated in one line. Given a fraction p/q with 0 < p < q, take

n = ⌈q ÷ p⌉, emit the term 1/n, and replace p/q with (−q mod p) / (nq)

where the new numerator is equivalently np − q. The essential fact is that this new numerator is strictly smaller than p. Since the numerator is a positive integer that decreases at every step, it must reach zero after at most p steps, so the process always terminates. Wolfram MathWorld's page on the Egyptian fraction gives the algorithm, its termination proof and several of the alternative expansion methods.

Work the default through by hand. Start with 4/13. The ceiling of 13 ÷ 4 is 4, so the first term is 1/4, and 4/13 − 1/4 = (16 − 13) ÷ 52 = 3/52. Next, the ceiling of 52 ÷ 3 is 18, so the second term is 1/18, and 3/52 − 1/18 = (54 − 52) ÷ 936 = 2/936, which reduces to 1/468. That is already a unit fraction, so the expansion is

4/13 = 1/4 + 1/18 + 1/468

Check it: 1/4 = 0.25, 1/18 ≈ 0.055556 and 1/468 ≈ 0.002137, summing to 0.307692, which is 4/13 to six places. Notice how the numerator fell 4, 3, 2, 1 — one step at a time, exactly as the termination proof requires.

Advertisement

Why the Denominators Explode

Press the 5/121 button and watch what happens. The numerator only has to fall from 5 to zero, so the expansion is at most five terms — and yet the last denominator has twenty-five digits. This is the standard illustration of the greedy method's weakness.

The cause is in the recurrence. Each step multiplies the denominator by roughly q/p, and since p is falling towards one while q keeps growing, the multiplier grows too. The denominators therefore grow roughly by squaring at each step. Five steps of squaring turns a two-digit number into a twenty-five-digit one, which is exactly what you see.

The same doubly exponential growth appears in Sylvester's sequence, 2, 3, 7, 43, 1807, 3263443, where each term is the product of all the previous terms plus one. That sequence is the greedy expansion of 1, and its entry in the On-Line Encyclopedia of Integer Sequences, A000058, records how quickly it runs away. Our scientific notation converter is useful for getting a feel for numbers at that scale.

Greedy is not the only method. Splitting uses the identity 1/n = 1/(n+1) + 1/(n(n+1)) to lengthen an expansion, the binary or practical-number methods keep denominators far smaller, and for many fractions a short expansion exists that greedy never finds. Finding the shortest expansion, or the one with the smallest largest denominator, is a genuinely hard computational problem with no known efficient algorithm.

Why Anyone Wrote Fractions This Way

Ancient Egyptian arithmetic used unit fractions almost exclusively, with 2/3 as the one common exception. The Rhind Mathematical Papyrus, copied around 1550 BCE, opens with a table expressing 2/n for every odd n from 5 to 101 as a sum of unit fractions — a lookup table for the operation this page automates. MathWorld's page on the Rhind papyrus describes the document and its contents.

The choices in that table are not greedy. For 2/13 the greedy method gives 1/7 + 1/91, but the papyrus gives 1/8 + 1/52 + 1/104 — three terms rather than two, yet with a much smaller largest denominator. Whoever compiled it was optimising for something other than term count, most likely for denominators that were easy to halve and double, which is how Egyptian multiplication worked.

There is also a practical reading. Dividing seven loaves among ten people as 1/2 + 1/5 gives everyone a half and a fifth, requiring only a handful of cuts, whereas 7/10 each has no obvious construction with a knife. Unit fractions describe a physical procedure, not just a quantity, and that is a genuinely different way to think about division. Our ratio calculator handles the modern framing of the same sharing problems.

Need exact arithmetic rather than floating point?

Arb Digital builds free tools that use big-integer arithmetic where precision actually matters.

Browse All Free Tools Talk To Our Team

Finding the shortest Egyptian expansion of a given fraction is an unsolved problem in general, which is why this page ships the greedy method under its own name rather than claiming to produce a best answer. A related question is still open: the Erdős–Straus conjecture asserts that every fraction of the form 4/n with n greater than 1 can be written as a sum of exactly three unit fractions. It has been verified by computer far beyond any range you are likely to enter here, and it has never been proved. If you find a fraction where the greedy expansion runs longer than you expected, that is the method being greedy rather than the fraction being difficult, and a shorter expansion may well exist.

Common Mistakes to Avoid

  • Assuming greedy gives the shortest expansion — it very often does not, and for 5/121 it uses five terms where three suffice.
  • Repeating a denominator — an Egyptian fraction requires the unit fractions to be distinct, which is what makes the problem interesting rather than trivial.
  • Computing the steps in floating point — precision is lost within three or four steps and the remaining fraction becomes meaningless.
  • Expecting a fixed number of terms — the count is bounded by the reduced numerator, so 5/121 needs at most five terms however large the denominator is.
  • Reading a stopped run as a failure — the algorithm always terminates; the digit limit stops the display, and the outstanding fraction is reported so you can continue.

Related Free Tools From Arb Digital

Do ordinary fraction arithmetic with the fraction calculator, reduce to lowest terms with the simplify fractions calculator, convert a decimal back to a fraction with the decimal to fraction calculator, handle whole-and-part values with the mixed number calculator, share quantities with the ratio calculator, or handle very large numbers with the scientific notation converter. The full free online tools hub lists every mathematics tool we publish.

Frequently Asked Questions

What is an Egyptian fraction?

It is a sum of distinct unit fractions, each with a numerator of one and no denominator used twice. Every positive rational number can be written this way, in infinitely many different ways.

How does the greedy algorithm work?

At each step it subtracts the largest unit fraction that does not exceed what remains, which means taking the ceiling of the denominator divided by the numerator, and repeats on the remainder.

Does the greedy method always terminate?

Yes. Each step leaves a remainder whose numerator is strictly smaller than the previous one, so a positive integer numerator must reach zero in at most that many steps.

Why do the denominators get so large?

Each step roughly squares the denominator, because the multiplier is about the denominator divided by a numerator that is falling towards one. Five steps can turn two digits into twenty-five.

Is the greedy expansion the shortest one?

Usually not. Finding the shortest expansion, or the one whose largest denominator is smallest, is a hard computational problem with no known efficient general algorithm.

Why does this tool use big-integer arithmetic?

Because ordinary floating point loses the exact remainder within three or four steps, after which every subsequent denominator is wrong. Exact integers are the only way to keep the result correct.

What happens with a fraction greater than one?

The whole-number part is taken out first and displayed separately, because repeating the unit fraction one over one would break the requirement that the terms are distinct.

Did the Egyptians use the greedy method?

No. The Rhind papyrus table often chooses more terms with smaller denominators than greedy would give, suggesting it was optimised for ease of halving and doubling rather than for brevity.

This page explains a classical result in number theory for educational purposes. All arithmetic is carried out in exact arbitrary-precision integers, so the expansions shown are exact rather than rounded.

Advertisement
Advertisement

Take it further