Nepedia
Back to Discover
Fluent Reader
🔢

Euclidean algorithm

math Maturity 7-9 Next article →

Imagine you have two different lengths and want to find the largest ruler that fits into both perfectly. This special number is called the greatest common divisor, or GCD. It is the largest number that can divide two integers without leaving any remainder. You can picture this by looking at a rectangle with different side lengths. If you can fill that entire rectangle with equal squares, the side of that square is a common divisor. The GCD is simply the largest possible square that can do this.

24x60
24x60

There is a clever way to find this number using a series of steps. This method is called an algorithm. One way is to take the larger number and subtract the smaller number from it. You then repeat this with the new pair of numbers. This makes the numbers get smaller and smaller each time. Eventually, the two numbers will become equal. That final number is your GCD.

Euclid's algorithm Book VII Proposition 2 3
Euclid's algorithm Book VII Proposition 2 3

A faster way to do this uses remainders instead of just subtracting. Instead of subtracting many times, you divide the larger number by the smaller one. You then take the remainder and use it with the smaller number. You keep doing this until you reach a remainder of zero. The last non-zero remainder you found is the GCD. This version is much quicker for very large numbers.

Euclidean algorithm 1071 462
Euclidean algorithm 1071 462

This method is named after Euclid, an ancient Greek mathematician. He first described it in his famous work called *Elements*. It is one of the oldest algorithms still used today. In 1844, a mathematician named Gabriel Lamé studied how fast this works. He proved that the number of steps is never more than five times the number of digits in the smaller number. This discovery helped start the study of how hard math problems are to solve.

Euklid
Euklid

Today, this math is used for many important jobs. It helps people simplify fractions to their simplest form. It is also used in cryptography to keep internet communications secure. Cryptography is a way of using math to protect secrets. The algorithm is also used to solve complex equations and find patterns in numbers. It even helps mathematicians prove deep rules about how numbers work.

Euclidean Algorithm Running Time
Euclidean Algorithm Running Time
364 words

Where will your curiosity go next?

Keep exploring at your chosen reading level.

🖼️ Images & Media (9)
File:Euclid's algorithm Book VII Proposition 2 3.svg
Euclid's algorithm Book VII Proposition 2 3.svg
File:24x60.svg
24x60.svg
File:Euclidean algorithm 1071 462.gif
Euclidean algorithm 1071 462.gif
File:Euklid.jpg
Euklid.jpg
File:Diophante Bezout.svg
Diophante Bezout.svg
File:SternBrocotTree.svg
SternBrocotTree.svg
File:Euclidean Algorithm Running Time.svg
Euclidean Algorithm Running Time.svg
File:Gaussian primes.svg
Gaussian primes.svg
File:Eisenstein primes.svg
Eisenstein primes.svg
More to explore

What is Nepedia?

A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.