Skip to content

Commit 499dfb9

Browse files
author
Oleksandr Kulkov
authored
Update euclid-algorithm.md
clarification
1 parent 9a365ee commit 499dfb9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/algebra/euclid-algorithm.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The algorithm was first described in Euclid's "Elements" (circa 300 BC), but it
1414

1515
## Algorithm
1616

17-
Originally, Euclidean algorithm was formulated as follows: subtract smaller number from the larger one until one of the numbers is zero. Indeed, if $g$ divides $a$ and $b$, it also divides $a-b$. On the other hand, if $g$ divides $a-b$ and $b$, then it also divides $a = b + (a-b)$, which means that the sets of divisors of $\{a, b\}$ and $\{b,a-b\}$ coincide.
17+
Originally, Euclidean algorithm was formulated as follows: subtract smaller number from the larger one until one of the numbers is zero. Indeed, if $g$ divides $a$ and $b$, it also divides $a-b$. On the other hand, if $g$ divides $a-b$ and $b$, then it also divides $a = b + (a-b)$, which means that the sets of common divisors of $\{a, b\}$ and $\{b,a-b\}$ coincide.
1818

1919
Note that $a$ remains the larger number until $b$ is subtracted from it at least $\left\lfloor\frac{a}{b}\right\rfloor$ times. Therefore, to speed things up, $a-b$ is substituted with $a-\left\lfloor\frac{a}{b}\right\rfloor b = a \bmod b$. Then the algorithm can be formulated in an extremely simple way:
2020

0 commit comments

Comments
 (0)