Egyptian Fraction Calculator

Fractions as sums of distinct unit fractions.

  • Greedy and shortest
  • Exact big integers
  • Every sum checked
Soft clay loaves cut into slices of different sizes and laid out in rows on a small rounded clay table in daylight.

The guide

One fraction, many answers: why the obvious Egyptian fraction is often the worst one

Greedy expansion always works, yet it can hand back a denominator of 25 digits where three small terms would do. A search for shorter answers shows what can and cannot be proved.

  • 1202 year Fibonacci described the greedy method
  • 50 expansions in the Rhind papyrus 2/n table
  • 25 digits last greedy denominator of 5/121
  • 363 largest denominator of 1/33 + 1/121 + 1/363
  • 8 terms longest greedy run below denominator 120
Read the full guide Fold the guide 7 min · 14 sources

Ask for 5/121 as a sum of distinct unit fractions and two methods give two very different answers. One takes the biggest piece that fits at every step and ends with five terms, the last of them 1/1,527,612,795,642,093,418,846,225. The other finds 1/33 + 1/121 + 1/363. Both add up to exactly 5/121. Neither is wrong, but only one is something a person could write on a page. That gap, between a method that always works and an answer worth keeping, is the whole subject of Egyptian fractions.

Why a scribe would split every fraction

An Egyptian fraction is a finite sum of distinct unit fractions, each with 1 on top and a whole number below. Every positive rational number can be written this way, and the word distinct matters.

The notation comes from ancient Egypt. The Rhind papyrus, copied by the scribe Ahmes around 1550 BC, opens with a table of 50 expansions of 2/n for odd n from 3 to 101. Two entries show the spirit: 2/5 is 1/3 + 1/15, and 2/101 is 1/101 + 1/202 + 1/303 + 1/606. The obvious answer for 2/5, one fifth twice, is missing because the Egyptians required every fraction in the sum to differ.

The practical use is sharing. Five loaves among eight people is 5/8, which is 1/2 + 1/8: cut four loaves in half and the last loaf into eighths, and every person takes one half and one eighth. Problems 1 to 6 of the same papyrus divide loaves among ten men and record each share as unit fractions. A unit fraction is simply what you get when something is cut into equal parts, which is why classrooms still use them to teach fair division before general fractions. The sum is a recipe for cutting, not only a number.

Distinctness is not a technicality. Write 2/5 as 1/5 + 1/5 and the arithmetic is right, yet the result is not an Egyptian fraction. A calculator has to reject it, and 1/3 + 1/15 passes.

The greedy method, and why it always stops

Leonardo of Pisa, known as Fibonacci, wrote his Liber Abaci in 1202. Part of it lists ways to turn ordinary fractions into unit fractions. Several of them need a denominator with many divisors, or one just below such a number. As a last resort he suggests the greedy method: take the largest unit fraction that does not exceed what is left, then repeat on the remainder. For x/y the first piece is 1/q, where q is y divided by x, rounded up. His examples include 4/13 = 1/4 + 1/18 + 1/468 and 17/29 = 1/2 + 1/12 + 1/348.

Why does it end? After subtracting 1/q the remainder is (xq - y) / (yq). Because q is the smallest whole number that is at least y/x, it is less than y/x + 1, so xq - y is less than x. The numerator falls at every step, a whole number cannot fall forever, and the method stops after at most x terms. The terms are distinct as well: the remainder after 1/q is smaller than 1/(q(q-1)), so the next denominator is larger than q. Both arguments are derived here and checked by the tool.

Try 4/13. Thirteen over four is 3.25, rounded up to 4, so the first term is 1/4 and 4/13 - 1/4 = 3/52. Fifty-two over three is about 17.3, rounded up to 18, so the second term is 1/18 and 3/52 - 1/18 = 1/468. A unit fraction remains, so the third term is 1/468. Three steps, and 1/4 + 1/18 + 1/468 adds back to 4/13 exactly. You can reproduce it by typing 4 and 13 into the tool.

The same check covered 7,021 fractions with denominators from 2 to 119. Every one added back correctly, with distinct denominators and no more terms than its numerator. The longest takes 8 terms, and 44/53, 8/97 and 84/101 all reach that length.

Why the denominators explode

Greedy is guaranteed to finish, not to finish nicely. Back to 5/121: its greedy terms are 1/25, 1/757, 1/763309, 1/873960180913 and a last denominator of 25 digits. The three-term answer 1/33 + 1/121 + 1/363 needs no number above 363.

The reason is arithmetic. The next denominator is the old one times q, divided by any common factor, and q is about y/x. When the numerator x is small compared with y, the new denominator is roughly the square of the old one divided by x. Squaring doubles the number of digits. The tool measured this on 31/311, whose ten greedy denominators have 2, 3, 5, 9, 17, 34, 67, 134, 269 and 537 digits. Wikipedia credits this example to Wagon and notes a four-term answer, 1/12 + 1/63 + 1/2799 + 1/8708, that is shorter by every measure.

The extreme case was studied by James Joseph Sylvester in 1880. Apply the greedy idea to the number 1, always choosing the denominator that keeps the sum just below 1, and you get 2, 3, 7, 43, 1807, 3263443. Each term is the product of all earlier ones plus one, so the sequence grows doubly exponentially. The four terms 1/2 + 1/3 + 1/7 + 1/43 add up to 1805/1806, and any Egyptian fraction strictly between 1805/1806 and 1 needs at least five terms. Long expansions are sometimes unavoidable, not only a flaw of one method.

Theory gives some comfort. Every fraction x/y has an expansion with at most about log y terms, and it is conjectured that about log log y always suffice. That last part remains a conjecture.

Searching for something shorter

Fibonacci’s other methods often do better. He splits 8/11 into 6/11 + 2/11, applies an identity to each part, and gets 1/2 + 1/22 + 1/6 + 1/66. Greedy gives 1/2 + 1/5 + 1/37 + 1/4070 for the same fraction. Both have four terms, but the largest denominator drops from 4070 to 66. Terms and size are different measures, so the tool reports both: fewest terms first, then the smallest largest denominator.

A search can do this without cleverness. Suppose k terms remain to be written for a remainder p/q. The next denominator x cannot be smaller than q/p rounded up, or the term would be too big. It cannot exceed k times q/p either, because k terms of size 1/x or less would then add up to less than p/q. That gives a finite range to try. When one term is left, the remainder must itself be a unit fraction, so the last denominator is forced and needs no cap. When two are left, x fixes the last term as qx/(px - q), which must be a whole number larger than x.

Take 5/121. With two terms, the first denominator must lie between 25 and 48, and none of those 24 candidates leaves a unit fraction, so no two-term answer exists. With three terms the tool finds 21 answers when the denominators it tries stop at 100000, and the one with the smallest largest denominator is 1/33 + 1/121 + 1/363. A common denominator of 363 shows why: 11/363 + 3/363 + 1/363 = 15/363, and 15/363 reduces to 5/121. Every shorter length was searched without a cut, so both the three terms and the 363 are proved.

A cap is where honesty enters. Searching denominators only up to some limit proves a result only if that limit never cut a range. When the cap does cut one, the answer is the best within the cap and nothing more. The tool says which case you are in, level by level. For 44/53, whose greedy answer has 8 terms, the search of one to four terms finished with no cut and found nothing, which proves that no expansion with four or fewer terms exists. Wikipedia notes that brute force like this can be inefficient, and that nobody knows whether a polynomial-time method exists for the shortest expansion.

What nobody has settled

Several questions remain open. The Erdos-Straus conjecture asks whether 4/n is always a sum of three unit fractions. Computer searches have confirmed it for every n up to 10^17, but no proof is known. This tool does not touch it, and a search limited to four terms and a denominator cap could never settle it.

The odd greedy method is another. Choose at each step the smallest odd denominator that fits. Nobody knows whether this always ends for a fraction with an odd denominator. It is known that such a fraction has some expansion into distinct odd unit fractions. For 3/179 the odd greedy expansion has 19 terms and its largest denominator is about 1.415 times 10^439491.

Some old questions did fall. The Erdos-Graham conjecture, that any finite coloring of the integers above one contains a finite single-color set whose reciprocals sum to one, was proved by Ernest Croot in 2003.

Exact arithmetic matters for all of this. A plain floating-point number holds whole numbers exactly only up to 9,007,199,254,740,991, which is 2^53 - 1, and the last denominator of 5/121 is roughly 170 million times larger. The BigInt type keeps every digit and refuses to mix with ordinary numbers, which guards against silent rounding. A search that may run for seconds belongs in a web worker, a background thread, so the page stays responsive.

What the method cannot do is just as plain. It cannot prove a shortest expansion past what was searched, it looks for at most four terms, and it says nothing about expansions that use only odd denominators. When a greedy run would need a denominator of more than 10,000 digits, the tool stops and shows the exact remainder instead of pretending to finish.

Sources

Every source consulted for this guide. Links checked November 10, 2026.

  1. Egyptian fraction - Wikipedia Wikipedia (CC BY-SA 4.0)
  2. Greedy algorithm for Egyptian fractions - Wikipedia Wikipedia (CC BY-SA 4.0)
  3. Sylvester's sequence - Wikipedia Wikipedia (CC BY-SA 4.0)
  4. Rhind Mathematical Papyrus - Wikipedia Wikipedia (CC BY-SA 4.0)
  5. Rhind Mathematical Papyrus 2/n table - Wikipedia Wikipedia (CC BY-SA 4.0)
  6. Unit fraction - Wikipedia Wikipedia (CC BY-SA 4.0)
  7. Liber Abaci - Wikipedia Wikipedia (CC BY-SA 4.0)
  8. Erdős–Straus conjecture - Wikipedia Wikipedia (CC BY-SA 4.0)
  9. Odd greedy expansion - Wikipedia Wikipedia (CC BY-SA 4.0)
  10. Erdős–Graham problem - Wikipedia Wikipedia (CC BY-SA 4.0)
  11. A000058 - OEIS The On-Line Encyclopedia of Integer Sequences (CC BY-SA 4.0)
  12. BigInt - JavaScript | MDN MDN Web Docs (Creative Commons licence)
  13. Number.MAX_SAFE_INTEGER - JavaScript | MDN MDN Web Docs (Creative Commons licence)
  14. Web Workers API - Web APIs | MDN MDN Web Docs (Creative Commons licence)