Az egyiptomi törtek titka: ősi matek, modern tanulságok
Ancient Algorithms: What Egyptian Fractions Teach Us About Computing
Think about the last time you wrote a recursive function. Did you know you were following a tradition that dates back nearly 4,000 years? Egyptian fractions—expressions written only as sums of unit fractions (where the numerator is always 1)—represent one of humanity's earliest documented algorithmic thinking. And honestly, they're far more clever than most people realize.
The Bread Problem
We take modern fraction notation for granted. Writing 3/7 or 5/12 feels completely natural to us. But here's a surprise: this notation didn't catch on in Europe until the 1700s. For most of recorded history, expressing fractions required a different approach.
The ancient Egyptians had to figure out practical problems. Say you have 7 loaves of bread and 8 hungry people. How do you divide things fairly? The answer wasn't simply writing 7/8. Instead, you'd break it down into a sum of distinct unit fractions: 1/2 + 1/4 + 1/8.
Seems simple, right? But getting computers (or mathematicians) to do this automatically requires surprisingly sophisticated reasoning.
The Algorithm Behind the Method
Here's where things get interesting for anyone who writes code. The technique Egyptians used to transform any fraction into this form is essentially what we now call a greedy algorithm—always pick the largest unit fraction you can, subtract it, then repeat.
Let me show you how it works. Suppose we want to express 4/23 as Egyptian fractions. The algorithm asks: what's the smallest integer bigger than 23 divided by 4? That's 6. So our first unit fraction is 1/6. Subtract it: 4/23 minus 1/6 gives us 1/138. And just like that, we're done: 4/23 equals 1/6 plus 1/138.
Mathematicians proved this always works in 1880, but Europeans had actually learned the technique from Fibonacci centuries earlier—around the 12th century.
Why Developers Should Care
You might be thinking: "Cool history lesson, but does this actually matter to me?"
Actually, yes. When you analyze what's happening in that ancient algorithm, you find three concepts that show up everywhere in modern programming:
- Breaking down complexity – You take a big problem and replace it with a simpler version of itself.
- Making greedy choices – At each step, you pick the option that seems best right now.
- Knowing when to stop – The remainder keeps getting smaller, which guarantees the process finishes.
Every time you write a recursive function, you're using the same logical structure these ancient mathematicians pioneered.
A Complicated Legacy
There's something important we should acknowledge. The Egyptian fraction method existed thousands of years before Greek mathematics even started. Yet when European scholars "rediscovered" the Rhind Papyrus in the 1800s, they often credited Greek thinkers instead of acknowledging Egypt as the true origin.
This pattern—where contributions from African and other non-European civilizations get quietly rewritten out of mathematical history—still affects how we teach computer science today.
A Mathematical Puzzle
Here's something fascinating: some historians point to what they call the "Egyptian triple"—the numbers 13, 17, and 173. When you read them as 3 + 1/13 + 1/17 + 1/173, this expression gets π accurate to four decimal places. That's actually closer than the commonly cited Egyptian value of 3.16.
Was this intentional mathematical precision, or just a happy accident? Scholars still debate this one.
Where It All Leads
Egyptian fractions aren't just historical curiosities—they connect directly to continued fractions, a topic still actively studied in computer science and number theory. That greedy algorithm approach shows up in modern problems involving resource allocation, scheduling, and optimization.
So the next time you're debugging a recursive function or defending why your greedy solution actually works, remember: you're joining a mathematical conversation that's been going for nearly four millennia.
Sometimes the oldest solutions are still the most elegant.