<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://drorbn.net/index.php?action=history&amp;feed=atom&amp;title=Computing_GCDs_over_the_Gaussian_Integers</id>
	<title>Computing GCDs over the Gaussian Integers - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://drorbn.net/index.php?action=history&amp;feed=atom&amp;title=Computing_GCDs_over_the_Gaussian_Integers"/>
	<link rel="alternate" type="text/html" href="https://drorbn.net/index.php?title=Computing_GCDs_over_the_Gaussian_Integers&amp;action=history"/>
	<updated>2026-05-04T16:01:57Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.6</generator>
	<entry>
		<id>https://drorbn.net/index.php?title=Computing_GCDs_over_the_Gaussian_Integers&amp;diff=11086&amp;oldid=prev</id>
		<title>Pgadey at 19:56, 26 November 2011</title>
		<link rel="alternate" type="text/html" href="https://drorbn.net/index.php?title=Computing_GCDs_over_the_Gaussian_Integers&amp;diff=11086&amp;oldid=prev"/>
		<updated>2011-11-26T19:56:52Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 15:56, 26 November 2011&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;I wrote up a very simple Perl script for computing GCDs over the Gaussian integers. It comes with no guarantee or proof of correctness. One can sketchily argue something like this however:&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;I wrote up a very simple Perl script for computing GCDs over the Gaussian integers. It comes with no guarantee or proof of correctness. One can sketchily argue something like this however:&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty diff-side-deleted&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;a class=&quot;mw-diff-movedpara-right&quot; title=&quot;Paragraph was moved. Click to jump to old location.&quot; href=&quot;#movedpara_3_0_lhs&quot;&gt;&amp;#x26AB;&lt;/a&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;a name=&quot;movedpara_1_0_rhs&quot;&gt;&lt;/a&gt;&#039;&#039;Claim&#039;&#039;: &amp;lt;math&amp;gt;\&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;mathbb{Z}&lt;/ins&gt;[i]&amp;lt;/math&amp;gt; is a Euclidean domain, and hence a PID, and hence a UFD.&amp;lt;br /&amp;gt;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;a class=&quot;mw-diff-movedpara-left&quot; title=&quot;Paragraph was moved. Click to jump to new location.&quot; href=&quot;#movedpara_1_0_rhs&quot;&gt;&amp;#x26AB;&lt;/a&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;a name=&quot;movedpara_3_0_lhs&quot;&gt;&lt;/a&gt;&#039;&#039;Claim&#039;&#039;: &amp;lt;math&amp;gt;\&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;ZZ&lt;/del&gt;[i]&amp;lt;/math&amp;gt; is a Euclidean domain, and hence a PID, and hence a UFD.&amp;lt;br /&amp;gt;&lt;/div&gt;&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty diff-side-added&quot;&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty diff-side-deleted&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;a class=&quot;mw-diff-movedpara-right&quot; title=&quot;Paragraph was moved. Click to jump to old location.&quot; href=&quot;#movedpara_7_0_lhs&quot;&gt;&amp;#x26AB;&lt;/a&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;a name=&quot;movedpara_5_0_rhs&quot;&gt;&lt;/a&gt;Consider the norm function &amp;lt;math&amp;gt;\nu(a + bi) = a^2 + b^2&amp;lt;/math&amp;gt;. We write the standard norm on the complex plane as &amp;lt;math&amp;gt;||a+bi||_{\mathbb{C}} = \sqrt{a^2 + b^2}&amp;lt;/math&amp;gt;. We show that for all &amp;lt;math&amp;gt;x \neq 0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt; we have, &amp;lt;math&amp;gt; y = qx + r &amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;\nu(r) = 0&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;\nu(r) &amp;lt; \nu(x)&amp;lt;/math&amp;gt;. Consider &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt; as points on the complex plane. Since &amp;lt;math&amp;gt;x \neq 0&amp;lt;/math&amp;gt; we have that &amp;lt;math&amp;gt;y/x&amp;lt;/math&amp;gt; is another point in the complex plane. Consider &amp;lt;math&amp;gt;\&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;mathbb{Z}&lt;/ins&gt;[i]&amp;lt;/math&amp;gt; as the points with integer coordinates in &amp;lt;math&amp;gt;\mathbb{C}&amp;lt;/math&amp;gt;. For any point &amp;lt;math&amp;gt;\zeta \in \mathbb{C}&amp;lt;/math&amp;gt; we can find a &amp;lt;math&amp;gt;\zeta&#039; \in \&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;mathbb{Z}&lt;/ins&gt;[i]&amp;lt;/math&amp;gt; such that &amp;lt;math&amp;gt;||\zeta - \zeta&#039;||_{\mathbb{C}} \leq \sqrt{2}/2&amp;lt;/math&amp;gt; by taking the &amp;lt;math&amp;gt;\zeta&#039;&amp;lt;/math&amp;gt; to be the nearest lattice point to &amp;lt;math&amp;gt;\zeta&amp;lt;/math&amp;gt;. Since any point on the plane is contained in a square whose vertices are lattice points and whose side lengths are one, there must be a lattice point nearer than half the diagonal of the square. We then take &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; to be the nearest lattice point to &amp;lt;math&amp;gt;y/x&amp;lt;/math&amp;gt;. We then have &amp;lt;math&amp;gt;y = zx + (y - zx)&amp;lt;/math&amp;gt;. We compute the norm of &amp;lt;math&amp;gt;\nu(y - zx)&amp;lt;/math&amp;gt;. We have: &amp;lt;math&amp;gt; \sqrt{\nu(y - zx)} = ||y - zx||_{\mathbb{C}} = ||x||_{\mathbb{C}} \cdot ||y/x - z||_{\mathbb{C}} \leq ||x||_{\mathbb{C}} \frac{\sqrt{2}}{2} &amp;lt; ||x||_{\mathbb{C}} = \sqrt{\nu(x)} &amp;lt;/math&amp;gt; It follows that &amp;lt;math&amp;gt;\nu(y - zy) &amp;lt; \nu(x)&amp;lt;/math&amp;gt;. We obtain that &amp;lt;math&amp;gt;\&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;mathbb{Z}&lt;/ins&gt;[i]&amp;lt;/math&amp;gt; is a Euclidean domain. Thus &amp;lt;math&amp;gt;\&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;mathbb{Z}&lt;/ins&gt;[i]&amp;lt;/math&amp;gt; is a PID and hence a UFD by results given in class.&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty diff-side-added&quot;&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;a class=&quot;mw-diff-movedpara-left&quot; title=&quot;Paragraph was moved. Click to jump to new location.&quot; href=&quot;#movedpara_5_0_rhs&quot;&gt;&amp;#x26AB;&lt;/a&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;a name=&quot;movedpara_7_0_lhs&quot;&gt;&lt;/a&gt;Consider the norm function &amp;lt;math&amp;gt;\nu(a + bi) = a^2 + b^2&amp;lt;/math&amp;gt;. We write the standard norm on the complex plane as &amp;lt;math&amp;gt;||a+bi||_{\mathbb{C}} = \sqrt{a^2 + b^2}&amp;lt;/math&amp;gt;. We show that for all &amp;lt;math&amp;gt;x \neq 0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt; we have, &amp;lt;math&amp;gt; y = qx + r &amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;\nu(r) = 0&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;\nu(r) &amp;lt; \nu(x)&amp;lt;/math&amp;gt;. Consider &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt; as points on the complex plane. Since &amp;lt;math&amp;gt;x \neq 0&amp;lt;/math&amp;gt; we have that &amp;lt;math&amp;gt;y/x&amp;lt;/math&amp;gt; is another point in the complex plane. Consider &amp;lt;math&amp;gt;\&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;ZZ&lt;/del&gt;[i]&amp;lt;/math&amp;gt; as the points with integer coordinates in &amp;lt;math&amp;gt;\mathbb{C}&amp;lt;/math&amp;gt;. For any point &amp;lt;math&amp;gt;\zeta \in \mathbb{C}&amp;lt;/math&amp;gt; we can find a &amp;lt;math&amp;gt;\zeta&#039; \in \&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;ZZ&lt;/del&gt;[i]&amp;lt;/math&amp;gt; such that &amp;lt;math&amp;gt;||\zeta - \zeta&#039;||_{\mathbb{C}} \leq \sqrt{2}/2&amp;lt;/math&amp;gt; by taking the &amp;lt;math&amp;gt;\zeta&#039;&amp;lt;/math&amp;gt; to be the nearest lattice point to &amp;lt;math&amp;gt;\zeta&amp;lt;/math&amp;gt;. Since any point on the plane is contained in a square whose vertices are lattice points and whose side lengths are one, there must be a lattice point nearer than half the diagonal of the square. We then take &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; to be the nearest lattice point to &amp;lt;math&amp;gt;y/x&amp;lt;/math&amp;gt;. We then have &amp;lt;math&amp;gt;y = zx + (y - zx)&amp;lt;/math&amp;gt;. We compute the norm of &amp;lt;math&amp;gt;\nu(y - zx)&amp;lt;/math&amp;gt;. We have: &amp;lt;math&amp;gt; \sqrt{\nu(y - zx)} = ||y - zx||_{\mathbb{C}} = ||x||_{\mathbb{C}} \cdot ||y/x - z||_{\mathbb{C}} \leq ||x||_{\mathbb{C}} \frac{\sqrt{2}}{2} &amp;lt; ||x||_{\mathbb{C}} = \sqrt{\nu(x)} &amp;lt;/math&amp;gt; It follows that &amp;lt;math&amp;gt;\nu(y - zy) &amp;lt; \nu(x)&amp;lt;/math&amp;gt;. We obtain that &amp;lt;math&amp;gt;\&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;ZZ&lt;/del&gt;[i]&amp;lt;/math&amp;gt; is a Euclidean domain. Thus &amp;lt;math&amp;gt;\&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;ZZ&lt;/del&gt;[i]&amp;lt;/math&amp;gt; is a PID and hence a UFD by results given in class.&lt;/div&gt;&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty diff-side-added&quot;&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;!-- diff cache key drordb-drorbn_:diff:wikidiff2:1.12:old-11085:rev-11086:1.13.0 --&gt;
&lt;/table&gt;</summary>
		<author><name>Pgadey</name></author>
	</entry>
	<entry>
		<id>https://drorbn.net/index.php?title=Computing_GCDs_over_the_Gaussian_Integers&amp;diff=11085&amp;oldid=prev</id>
		<title>Pgadey at 19:55, 26 November 2011</title>
		<link rel="alternate" type="text/html" href="https://drorbn.net/index.php?title=Computing_GCDs_over_the_Gaussian_Integers&amp;diff=11085&amp;oldid=prev"/>
		<updated>2011-11-26T19:55:55Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 15:55, 26 November 2011&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;I wrote up a very simple Perl script for computing GCDs over the Gaussian integers. It comes with no guarantee or proof of correctness. &lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;I wrote up a very simple Perl script for computing GCDs over the Gaussian integers. It comes with no guarantee or proof of correctness. &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;One can sketchily argue something like this however:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty diff-side-deleted&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty diff-side-deleted&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty diff-side-deleted&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&#039;&#039;Claim&#039;&#039;: &amp;lt;math&amp;gt;\ZZ[i]&amp;lt;/math&amp;gt; is a Euclidean domain, and hence a PID, and hence a UFD.&amp;lt;br /&amp;gt;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty diff-side-deleted&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty diff-side-deleted&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty diff-side-deleted&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Consider the norm function &amp;lt;math&amp;gt;\nu(a + bi) = a^2 + b^2&amp;lt;/math&amp;gt;. We write the standard norm on the complex plane as &amp;lt;math&amp;gt;||a+bi||_{\mathbb{C}} = \sqrt{a^2 + b^2}&amp;lt;/math&amp;gt;. We show that for all &amp;lt;math&amp;gt;x \neq 0&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt; we have, &amp;lt;math&amp;gt; y = qx + r &amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;\nu(r) = 0&amp;lt;/math&amp;gt; or &amp;lt;math&amp;gt;\nu(r) &amp;lt; \nu(x)&amp;lt;/math&amp;gt;. Consider &amp;lt;math&amp;gt;x&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;y&amp;lt;/math&amp;gt; as points on the complex plane. Since &amp;lt;math&amp;gt;x \neq 0&amp;lt;/math&amp;gt; we have that &amp;lt;math&amp;gt;y/x&amp;lt;/math&amp;gt; is another point in the complex plane. Consider &amp;lt;math&amp;gt;\ZZ[i]&amp;lt;/math&amp;gt; as the points with integer coordinates in &amp;lt;math&amp;gt;\mathbb{C}&amp;lt;/math&amp;gt;. For any point &amp;lt;math&amp;gt;\zeta \in \mathbb{C}&amp;lt;/math&amp;gt; we can find a &amp;lt;math&amp;gt;\zeta&#039; \in \ZZ[i]&amp;lt;/math&amp;gt; such that &amp;lt;math&amp;gt;||\zeta - \zeta&#039;||_{\mathbb{C}} \leq \sqrt{2}/2&amp;lt;/math&amp;gt; by taking the &amp;lt;math&amp;gt;\zeta&#039;&amp;lt;/math&amp;gt; to be the nearest lattice point to &amp;lt;math&amp;gt;\zeta&amp;lt;/math&amp;gt;. Since any point on the plane is contained in a square whose vertices are lattice points and whose side lengths are one, there must be a lattice point nearer than half the diagonal of the square. We then take &amp;lt;math&amp;gt;z&amp;lt;/math&amp;gt; to be the nearest lattice point to &amp;lt;math&amp;gt;y/x&amp;lt;/math&amp;gt;. We then have &amp;lt;math&amp;gt;y = zx + (y - zx)&amp;lt;/math&amp;gt;. We compute the norm of &amp;lt;math&amp;gt;\nu(y - zx)&amp;lt;/math&amp;gt;. We have: &amp;lt;math&amp;gt; \sqrt{\nu(y - zx)} = ||y - zx||_{\mathbb{C}} = ||x||_{\mathbb{C}} \cdot ||y/x - z||_{\mathbb{C}} \leq ||x||_{\mathbb{C}} \frac{\sqrt{2}}{2} &amp;lt; ||x||_{\mathbb{C}} = \sqrt{\nu(x)} &amp;lt;/math&amp;gt; It follows that &amp;lt;math&amp;gt;\nu(y - zy) &amp;lt; \nu(x)&amp;lt;/math&amp;gt;. We obtain that &amp;lt;math&amp;gt;\ZZ[i]&amp;lt;/math&amp;gt; is a Euclidean domain. Thus &amp;lt;math&amp;gt;\ZZ[i]&amp;lt;/math&amp;gt; is a PID and hence a UFD by results given in class.&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty diff-side-deleted&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty diff-side-deleted&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;----&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;----&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;!-- diff cache key drordb-drorbn_:diff:wikidiff2:1.12:old-11082:rev-11085:1.13.0 --&gt;
&lt;/table&gt;</summary>
		<author><name>Pgadey</name></author>
	</entry>
	<entry>
		<id>https://drorbn.net/index.php?title=Computing_GCDs_over_the_Gaussian_Integers&amp;diff=11082&amp;oldid=prev</id>
		<title>Pgadey at 19:47, 26 November 2011</title>
		<link rel="alternate" type="text/html" href="https://drorbn.net/index.php?title=Computing_GCDs_over_the_Gaussian_Integers&amp;diff=11082&amp;oldid=prev"/>
		<updated>2011-11-26T19:47:46Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 15:47, 26 November 2011&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;I wrote up a very simple Perl script for computing GCDs over the Gaussian integers. It comes with no guarantee. &lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;I wrote up a very simple Perl script for computing GCDs over the Gaussian integers. It comes with no guarantee&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; or proof of correctness&lt;/ins&gt;. &lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;----&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;----&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;!-- diff cache key drordb-drorbn_:diff:wikidiff2:1.12:old-11081:rev-11082:1.13.0 --&gt;
&lt;/table&gt;</summary>
		<author><name>Pgadey</name></author>
	</entry>
	<entry>
		<id>https://drorbn.net/index.php?title=Computing_GCDs_over_the_Gaussian_Integers&amp;diff=11081&amp;oldid=prev</id>
		<title>Pgadey at 19:46, 26 November 2011</title>
		<link rel="alternate" type="text/html" href="https://drorbn.net/index.php?title=Computing_GCDs_over_the_Gaussian_Integers&amp;diff=11081&amp;oldid=prev"/>
		<updated>2011-11-26T19:46:11Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 15:46, 26 November 2011&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 3:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 3:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;----&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;----&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty diff-side-deleted&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty diff-side-added&quot;&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#!/usr/bin/perl&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#!/usr/bin/perl&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;use Math::Complex;&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;use Math::Complex;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 52:&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 52:&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;amp;gcd($z1, $z2);&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;amp;gcd($z1, $z2);&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty diff-side-deleted&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-empty diff-side-deleted&quot;&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;

&lt;!-- diff cache key drordb-drorbn_:diff:wikidiff2:1.12:old-11080:rev-11081:1.13.0 --&gt;
&lt;/table&gt;</summary>
		<author><name>Pgadey</name></author>
	</entry>
	<entry>
		<id>https://drorbn.net/index.php?title=Computing_GCDs_over_the_Gaussian_Integers&amp;diff=11080&amp;oldid=prev</id>
		<title>Pgadey at 19:45, 26 November 2011</title>
		<link rel="alternate" type="text/html" href="https://drorbn.net/index.php?title=Computing_GCDs_over_the_Gaussian_Integers&amp;diff=11080&amp;oldid=prev"/>
		<updated>2011-11-26T19:45:52Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;I wrote up a very simple Perl script for computing GCDs over the Gaussian integers. It comes with no guarantee. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#!/usr/bin/perl&lt;br /&gt;
use Math::Complex;&lt;br /&gt;
&lt;br /&gt;
## A Quick hack for computing GCDs of Gaussian integers.&lt;br /&gt;
&lt;br /&gt;
$z2 = 857 + i;&lt;br /&gt;
$z1 = 255;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
sub gcd {&lt;br /&gt;
	# the Euclidean algorithm&lt;br /&gt;
&lt;br /&gt;
	my $x = $_[0];&lt;br /&gt;
	my $y = $_[1];&lt;br /&gt;
	&lt;br /&gt;
	if ($x * $y == 0) {&lt;br /&gt;
		print &amp;quot;Done!\n&amp;quot;;&lt;br /&gt;
	} else {&lt;br /&gt;
		$q = &amp;amp;approx($x/$y); &lt;br /&gt;
		$r = $x - $q*$y;&lt;br /&gt;
		print &amp;quot;($x) = ($q)($y) + ($r)\n&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
		&amp;amp;gcd($y,$r);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
sub approx {&lt;br /&gt;
	# find the nearest Gaussian integer to a point on the complex plane&lt;br /&gt;
&lt;br /&gt;
	my $z = $_[0];&lt;br /&gt;
&lt;br /&gt;
	my $x = int(Re($z));&lt;br /&gt;
	my $y = int(Im($z));&lt;br /&gt;
&lt;br /&gt;
	if (abs($z - (($x+1) + i*$y) ) &amp;lt; 1/sqrt(2)) {&lt;br /&gt;
		return ($x+1) + i*$y;&lt;br /&gt;
	} elsif (abs($z - (($x) + i*($y+1)) ) &amp;lt; 1/sqrt(2)) {&lt;br /&gt;
		return $x + i*($y+1);&lt;br /&gt;
	} elsif (abs($z - (($x+1) + i*($y+1)) ) &amp;lt; 1/sqrt(2)) {&lt;br /&gt;
		return ($x+1) + i*($y+1);&lt;br /&gt;
	} else {	&lt;br /&gt;
		return $x + i*$y;&lt;br /&gt;
	}	&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;amp;gcd($z1, $z2);&lt;/div&gt;</summary>
		<author><name>Pgadey</name></author>
	</entry>
</feed>