algorithm for computing greatest common divisors
The Euclidean algorithm is a step-by-step procedure for finding the greatest common divisor of two numbers—that is, the largest number that divides evenly into both of them. It's one of the oldest and most efficient mathematical methods known, and it remains important in modern mathematics and computer science for solving problems involving divisibility and number relationships.
AI-generated from the Wikipedia summary — may contain errors.
Euclid's method for finding the greatest common divisor (GCD) of two starting lengths BA and DC, both defined to be multiples of a common "unit" length. The length DC being shorter, it is used to "measure" BA, but only once because the remainder EA is less than DC. EA now measures (twice) the shorter length DC, with remainder FC shorter than EA. Then FC measures (three times) length EA. Because there is no remainder, the process ends with FC being the GCD. On the right Nicomachus's example with numbers 49 and 21 resulting in their GCD of 7 (derived from Heath 1908:300).
In mathematics, the Euclidean algorithm, or Euclid's algorithm, is an efficient method for computing the greatest common divisor (GCD) of two integers, the largest number that divides them both without a remainder. It is named after the ancient Greek mathematician Euclid, who first described it in his Elements (c. 300 BC). It is an example of an algorithm, and is one of the oldest algorithms in common use. It can be used to reduce fractions to their simplest form, and is a part of many other number-theoretic and cryptographic calculations.
Discovered by embedding cosine similarity (sentence-transformers MiniLM, 384-dim).