Skip to content

Commit 7846fb4

Browse files
committed
deploy: 99e453a
1 parent 22db7f9 commit 7846fb4

File tree

5 files changed

+19
-7
lines changed

5 files changed

+19
-7
lines changed

main/algebra/euclid-algorithm.html

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6522,6 +6522,14 @@
65226522

65236523

65246524

6525+
6526+
6527+
6528+
6529+
6530+
6531+
6532+
65256533

65266534

65276535

@@ -6620,6 +6628,10 @@
66206628

66216629

66226630

6631+
6632+
6633+
6634+
66236635

66246636

66256637

@@ -6632,7 +6644,7 @@
66326644
<ul class="metadata page-metadata" data-bi-name="page info" lang="en-us" dir="ltr">
66336645

66346646
Last update:
6635-
<span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">July 11, 2024</span>&emsp;
6647+
<span class="git-revision-date-localized-plugin git-revision-date-localized-plugin-date">October 13, 2024</span>&emsp;
66366648

66376649
<!-- Tags -->
66386650

@@ -6664,7 +6676,7 @@ <h1 id="euclidean-algorithm-for-computing-the-greatest-common-divisor">Euclidean
66646676
<div class="arithmatex">$$\gcd(a, b) = \max \{k &gt; 0 : (k \mid a) \text{ and } (k \mid b) \}$$</div>
66656677
<p>(here the symbol "<span class="arithmatex">$\mid$</span>" denotes divisibility, i.e. "<span class="arithmatex">$k \mid a$</span>" means "<span class="arithmatex">$k$</span> divides <span class="arithmatex">$a$</span>")</p>
66666678
<p>When one of the numbers is zero, while the other is non-zero, their greatest common divisor, by definition, is the second number. When both numbers are zero, their greatest common divisor is undefined (it can be any arbitrarily large number), but it is convenient to define it as zero as well to preserve the associativity of <span class="arithmatex">$\gcd$</span>. Which gives us a simple rule: if one of the numbers is zero, the greatest common divisor is the other number.</p>
6667-
<p>The Euclidean algorithm, discussed below, allows to find the greatest common divisor of two numbers <span class="arithmatex">$a$</span> and <span class="arithmatex">$b$</span> in <span class="arithmatex">$O(\log \min(a, b))$</span>.</p>
6679+
<p>The Euclidean algorithm, discussed below, allows to find the greatest common divisor of two numbers <span class="arithmatex">$a$</span> and <span class="arithmatex">$b$</span> in <span class="arithmatex">$O(\log \min(a, b))$</span>. Since the function is <strong>associative</strong>, to find the GCD of <strong>more than two numbers</strong>, we can do <span class="arithmatex">$\gcd(a, b, c) = \gcd(a, \gcd(b, c))$</span> and so forth.</p>
66686680
<p>The algorithm was first described in Euclid's "Elements" (circa 300 BC), but it is possible that the algorithm has even earlier origins.</p>
66696681
<h2 id="algorithm">Algorithm<a class="headerlink" href="#algorithm" title="Permanent link">&para;</a></h2>
66706682
<p>Originally, the Euclidean algorithm was formulated as follows: subtract the smaller number from the larger one until one of the numbers is zero. Indeed, if <span class="arithmatex">$g$</span> divides <span class="arithmatex">$a$</span> and <span class="arithmatex">$b$</span>, it also divides <span class="arithmatex">$a-b$</span>. On the other hand, if <span class="arithmatex">$g$</span> divides <span class="arithmatex">$a-b$</span> and <span class="arithmatex">$b$</span>, then it also divides <span class="arithmatex">$a = b + (a-b)$</span>, which means that the sets of the common divisors of <span class="arithmatex">$\{a, b\}$</span> and <span class="arithmatex">$\{b,a-b\}$</span> coincide.</p>
@@ -6744,7 +6756,7 @@ <h2 id="practice-problems">Practice Problems<a class="headerlink" href="#practic
67446756

67456757
<ul class="metadata page-metadata" data-bi-name="page info" lang="en-us" dir="ltr">
67466758
<span class="contributors-text">Contributors:</span>
6747-
<ul class="contributors" data-bi-name="contributors"><li><a href="https://github.com/jakobkogler" title="jakobkogler" data-bi-name="contributorprofile" target="_blank">jakobkogler</a> (48.06%)</li><li><a href="#" title="Nalin Bhardwaj" data-bi-name="contributorprofile" target="_blank">Nalin Bhardwaj</a> (34.11%)</li><li><a href="https://github.com/adamant-pwn" title="adamant-pwn" data-bi-name="contributorprofile" target="_blank">adamant-pwn</a> (11.63%)</li><li><a href="https://github.com/tcNickolas" title="tcNickolas" data-bi-name="contributorprofile" target="_blank">tcNickolas</a> (3.88%)</li><li><a href="https://github.com/AniketR10" title="AniketR10" data-bi-name="contributorprofile" target="_blank">AniketR10</a> (0.78%)</li><li><a href="https://github.com/itssachinkr" title="itssachinkr" data-bi-name="contributorprofile" target="_blank">itssachinkr</a> (0.78%)</li><li><a href="https://github.com/jinyulink" title="jinyulink" data-bi-name="contributorprofile" target="_blank">jinyulink</a> (0.78%)</li></ul>
6759+
<ul class="contributors" data-bi-name="contributors"><li><a href="https://github.com/jakobkogler" title="jakobkogler" data-bi-name="contributorprofile" target="_blank">jakobkogler</a> (47.29%)</li><li><a href="#" title="Nalin Bhardwaj" data-bi-name="contributorprofile" target="_blank">Nalin Bhardwaj</a> (34.11%)</li><li><a href="https://github.com/adamant-pwn" title="adamant-pwn" data-bi-name="contributorprofile" target="_blank">adamant-pwn</a> (11.63%)</li><li><a href="https://github.com/tcNickolas" title="tcNickolas" data-bi-name="contributorprofile" target="_blank">tcNickolas</a> (3.88%)</li><li><a href="https://github.com/mdeapedro" title="mdeapedro" data-bi-name="contributorprofile" target="_blank">mdeapedro</a> (0.78%)</li><li><a href="https://github.com/AniketR10" title="AniketR10" data-bi-name="contributorprofile" target="_blank">AniketR10</a> (0.78%)</li><li><a href="https://github.com/itssachinkr" title="itssachinkr" data-bi-name="contributorprofile" target="_blank">itssachinkr</a> (0.78%)</li><li><a href="https://github.com/jinyulink" title="jinyulink" data-bi-name="contributorprofile" target="_blank">jinyulink</a> (0.78%)</li></ul>
67486760
</ul>
67496761

67506762
</article>

0 commit comments

Comments
 (0)