{"id":3130,"date":"2021-11-21T01:31:09","date_gmt":"2021-11-21T09:31:09","guid":{"rendered":"https:\/\/wonghoi.humgar.com\/blog\/?p=3130"},"modified":"2023-08-26T21:13:48","modified_gmt":"2023-08-27T05:13:48","slug":"easiest-way-to-remember-euclid-gcd-algorithm-laying-tiles","status":"publish","type":"post","link":"https:\/\/wonghoi.humgar.com\/blog\/2021\/11\/21\/easiest-way-to-remember-euclid-gcd-algorithm-laying-tiles\/","title":{"rendered":"An easy way to remember Euclid GCD algorithm: laying tiles"},"content":{"rendered":"\n<p>I was a little embarrassed that I&#8217;ve never came across Euclid&#8217;s GCD algorithm until years after I graduated with Math and Engineering degrees. The descriptions I&#8217;ve found online (especially Wikipedia) are convoluted and confusing, and the mechanical description of the algorithm does not shine light to any intuition. Then there comes proofs and abstract algebra properties that even after I followed the reasoning, I&#8217;d soon forget after I stop looking at it in a few weeks.<\/p>\n\n\n\n<p>Just by staring at one simple description of the algorithm:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>The classic algorithm for computing the GCD, known as Euclid&#8217;s algorithm, goes as follows: Let <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-fdc40b8ad1cdad0aab9d632215459d28_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#109;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"15\" style=\"vertical-align: 0px;\"\/> and <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-ec4217f4fa5fcd92a9edceba0e708cf7_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#110;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"11\" style=\"vertical-align: 0px;\"\/> be variables containing the two numbers, divide <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-fdc40b8ad1cdad0aab9d632215459d28_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#109;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"15\" style=\"vertical-align: 0px;\"\/> by <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-ec4217f4fa5fcd92a9edceba0e708cf7_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#110;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"11\" style=\"vertical-align: 0px;\"\/>. Save the divisor in <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-fdc40b8ad1cdad0aab9d632215459d28_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#109;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"15\" style=\"vertical-align: 0px;\"\/>, and save the remainder in <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-ec4217f4fa5fcd92a9edceba0e708cf7_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#110;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"11\" style=\"vertical-align: 0px;\"\/>. If <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-ec4217f4fa5fcd92a9edceba0e708cf7_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#110;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"11\" style=\"vertical-align: 0px;\"\/> is <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-8354ade9c79ec6a7ac658f2c3032c9df_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#48;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"9\" style=\"vertical-align: 0px;\"\/>, then stop: <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-fdc40b8ad1cdad0aab9d632215459d28_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#109;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"15\" style=\"vertical-align: 0px;\"\/> contains the GCD. Otherwise repeat the process, starting with division of <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-fdc40b8ad1cdad0aab9d632215459d28_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#109;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"15\" style=\"vertical-align: 0px;\"\/> by <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-ec4217f4fa5fcd92a9edceba0e708cf7_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#110;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"11\" style=\"vertical-align: 0px;\"\/>.<\/p>\n<cite>K.N. King&#8217;s C++ Programming (Chapter 6 Exercise 2)<\/cite><\/blockquote>\n\n\n\n<p>I reversed engineered one line of reasoning how one could come up with the Euclid GCD on his own. Turns out there is one twist\/angle that most traditional explanations glossed over: <strong>quotients do NOT matter and WHY<\/strong> it does NOT matter!<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>It goes back to what GCD<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-6086dce942f84541c047c9105b280dd9_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#40;&#97;&#44;&#98;&#41;\" title=\"Rendered by QuickLaTeX.com\" height=\"19\" width=\"37\" style=\"vertical-align: -5px;\"\/> stands for: greatest common divisor. You are looking for the largest factor that simultaneously divides <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-0e55b0b3943237ccfc96979505679274_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#97;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"9\" style=\"vertical-align: 0px;\"\/> and <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-ad69adf868bc701e561aa555db995f1f_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#98;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"8\" style=\"vertical-align: 0px;\"\/> evenly. If you rethink in terms of multiplication,  you are finding the biggest tile size <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-276a76eafbebc4494deafceec7cc4ddd_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#99;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"8\" style=\"vertical-align: 0px;\"\/> that can simultaneously cover <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-0e55b0b3943237ccfc96979505679274_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#97;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"9\" style=\"vertical-align: 0px;\"\/> and <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-ad69adf868bc701e561aa555db995f1f_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#98;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"8\" style=\"vertical-align: 0px;\"\/> without gaps:<\/p>\n\n\n\n<p class=\"has-text-align-center\">Find <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-276a76eafbebc4494deafceec7cc4ddd_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#99;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"8\" style=\"vertical-align: 0px;\"\/> s.t. <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-277faf1ada2b28493ea22a7cbc0615b2_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#97;&#32;&#61;&#32;&#112;&#99;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"50\" style=\"vertical-align: -4px;\"\/> and <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-b4868377f64f8a7aa5102919e2893fae_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#98;&#61;&#32;&#113;&#99;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"48\" style=\"vertical-align: -4px;\"\/> where <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-b300ac8fbf094ae847c32af05ce7bd2d_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#112;&#44;&#113;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"26\" style=\"vertical-align: -4px;\"\/> are integers.<\/p>\n\n\n\n<p>Imagine you are a <strong>lazy<\/strong> and <strong>cheap<\/strong> contractor who have unlimited tile samples of all sizes to try before making a large order:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>[Goal] you have to cover with two floors with potentially different sizes <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-0e55b0b3943237ccfc96979505679274_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#97;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"9\" style=\"vertical-align: 0px;\"\/> and <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-ad69adf868bc701e561aa555db995f1f_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#98;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"8\" style=\"vertical-align: 0px;\"\/> <strong>gaplessly<\/strong><\/li>\n\n\n\n<li>[Constraint: <em>divisible<\/em>] your customer won&#8217;t let you cut (fractional) tiles because it&#8217;s ugly<\/li>\n\n\n\n<li>[Constraint: <em>common denominator<\/em>] you can only order ONE tile size to take advantage of bulk discounts<\/li>\n\n\n\n<li>[Objective: <em>greatest<\/em>] more tiles means more work to lay it, so you want to shop for the biggest tile size that does the job. <\/li>\n<\/ul>\n\n\n\n<p>For simplicity of the argument, we also assume the divisor <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-ad69adf868bc701e561aa555db995f1f_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#98;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"8\" style=\"vertical-align: 0px;\"\/> is the smaller number. If <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-ad69adf868bc701e561aa555db995f1f_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#98;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"8\" style=\"vertical-align: 0px;\"\/> is the bigger number, the roles will reverse in the next round because the remainder from dividing by a larger number is the dividend itself, which becomes the divisor in the next round while the old divisor (the larger number) becomes the dividend. <\/p>\n\n\n\n<p>For relatively prime pairs, the algorithm will eventually stop with a GCD of <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-69a7c7fb1023d315f416440bca10d849_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#49;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"7\" style=\"vertical-align: 0px;\"\/> because <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-69a7c7fb1023d315f416440bca10d849_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#49;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"7\" style=\"vertical-align: 0px;\"\/> divides all integers.<\/p>\n\n\n\n<p>Here&#8217;s the analog of Euclid algorithm:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>start out with 1 big tile covering the entire smaller floor <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-ad69adf868bc701e561aa555db995f1f_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#98;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"8\" style=\"vertical-align: 0px;\"\/><\/li>\n\n\n\n<li>see if we can cover <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-0e55b0b3943237ccfc96979505679274_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#97;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"9\" style=\"vertical-align: 0px;\"\/> without gaps using big tiles of size <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-ad69adf868bc701e561aa555db995f1f_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#98;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"8\" style=\"vertical-align: 0px;\"\/> <\/li>\n\n\n\n<li>if yes, we are done. <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-ad69adf868bc701e561aa555db995f1f_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#98;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"8\" style=\"vertical-align: 0px;\"\/>, the macro-tile is your GCD (perfect-sized tile).<\/li>\n\n\n\n<li>if there are gaps (non-zero remainder), pick a tile-size that covers the ugly gap (the remainder becomes the divisor), then repeat the same process above over the <strong>last<\/strong> tile size <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-ad69adf868bc701e561aa555db995f1f_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#98;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"8\" style=\"vertical-align: 0px;\"\/> (the divisor becomes the dividend) until there are no gaps (remainder become zero).<\/li>\n<\/ul>\n\n\n\n<p>The algorithm is taking advantage of the fact the remainder is smaller than the last tile size (divisor) so we can rewrite the last tile size in multiples of the remainder (old gap) plus the new gap. <span style=\"text-decoration: underline;\"><strong>By the time the new gap evenly divides the last tile (the big tile right before it), all numbers before that can be written as multiples of the new gap<\/strong><\/span> (i.e. the last gap evenly divides all the numbers in the chain all the way up to <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-ad69adf868bc701e561aa555db995f1f_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#98;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"8\" style=\"vertical-align: 0px;\"\/> and <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-0e55b0b3943237ccfc96979505679274_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#97;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"9\" style=\"vertical-align: 0px;\"\/>).<\/p>\n\n\n\n<p>Let&#8217;s start with a simple case GCD<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-e5c8f9911f6042d4dbbc6f8c42c8d8fe_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#40;&#97;&#61;&#53;&#48;&#44;&#32;&#98;&#61;&#49;&#53;&#41;\" title=\"Rendered by QuickLaTeX.com\" height=\"19\" width=\"120\" style=\"vertical-align: -5px;\"\/> that terminates early:<\/p>\n\n\n\n<p class=\"has-text-align-center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-e1912abceca1670919e9aa937af0124e_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#53;&#48;&#32;&#40;&#100;&#105;&#118;&#105;&#100;&#101;&#110;&#100;&#41;&#32;&#61;&#32;&#91;&#49;&#53;&#43;&#49;&#53;&#43;&#49;&#53;&#32;&#40;&#100;&#105;&#118;&#105;&#115;&#111;&#114;&#41;&#93;&#32;&#43;&#32;&#53;&#32;&#40;&#114;&#101;&#109;&#97;&#105;&#110;&#100;&#101;&#114;&#41;\" title=\"Rendered by QuickLaTeX.com\" height=\"19\" width=\"427\" style=\"vertical-align: -5px;\"\/><\/p>\n\n\n\n<p>We focus on the last tile <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-24356614dd1cedf9fcb381d867965978_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#49;&#53;\" title=\"Rendered by QuickLaTeX.com\" height=\"13\" width=\"16\" style=\"vertical-align: 0px;\"\/> and write it in terms of the old remainder <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-48348ef601c56286abf49bafe09c7af1_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#53;\" title=\"Rendered by QuickLaTeX.com\" height=\"13\" width=\"8\" style=\"vertical-align: 0px;\"\/>:<\/p>\n\n\n\n<p class=\"has-text-align-center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-2453399e6a26ded4a9b8d61d76c6b56f_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#49;&#53;&#32;&#61;&#32;&#40;&#53;&#43;&#53;&#43;&#53;&#41;&#32;&#43;&#32;&#48;\" title=\"Rendered by QuickLaTeX.com\" height=\"19\" width=\"155\" style=\"vertical-align: -5px;\"\/><\/p>\n\n\n\n<p>Since the new remainder is <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-8354ade9c79ec6a7ac658f2c3032c9df_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#48;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"9\" style=\"vertical-align: 0px;\"\/>, the old remainder <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-48348ef601c56286abf49bafe09c7af1_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#53;\" title=\"Rendered by QuickLaTeX.com\" height=\"13\" width=\"8\" style=\"vertical-align: 0px;\"\/> divides the last tile <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-24356614dd1cedf9fcb381d867965978_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#49;&#53;\" title=\"Rendered by QuickLaTeX.com\" height=\"13\" width=\"16\" style=\"vertical-align: 0px;\"\/>. Since we are dividing <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-0e55b0b3943237ccfc96979505679274_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#97;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"9\" style=\"vertical-align: 0px;\"\/> in terms of the remainder <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-48348ef601c56286abf49bafe09c7af1_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#53;\" title=\"Rendered by QuickLaTeX.com\" height=\"13\" width=\"8\" style=\"vertical-align: 0px;\"\/>, we have<\/p>\n\n\n\n<div class=\"wp-block-katex-display-block katex-eq\" data-katex-display=\"true\"><pre>\\begin{aligned}\nb &amp;= 15 \\\\\n&amp;= (5+5+5) \\\\\n&amp;= 3r \\\\\n\\\\\na &amp;= 50 \\\\\n&amp; = (15 + 15 + 15) + 5\\\\\n&amp; = 3b + r\\\\\n&amp;= (5+5+5) + (5+5+5) + (5+5+5) + 5\\\\\n&amp;= 3(3r)+r \\\\\n&amp; = 10r\n\\end{aligned}<\/pre><\/div>\n\n\n\n<p>So both <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-0e55b0b3943237ccfc96979505679274_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#97;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"9\" style=\"vertical-align: 0px;\"\/> and <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-ad69adf868bc701e561aa555db995f1f_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#98;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"8\" style=\"vertical-align: 0px;\"\/> can be written in terms of integer multiples of <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-01bcf7e9e043561da78fecf715c8a46e_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#114;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"8\" style=\"vertical-align: 0px;\"\/> right before the algorithm stops.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p>GCD<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-65b806f6dd70ded864919cd6904bdcd3_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#40;&#53;&#48;&#44;&#32;&#49;&#56;&#41;\" title=\"Rendered by QuickLaTeX.com\" height=\"19\" width=\"56\" style=\"vertical-align: -5px;\"\/> takes a few more steps: <\/p>\n\n\n\n<div class=\"wp-block-katex-display-block katex-eq\" data-katex-display=\"true\"><pre>\\begin{aligned}\nb &amp;= 18\\\\\na &amp;= 50\\\\\n&amp;= (18 + 18) + 14\\\\\n&amp;=2b + r\\\\\nr &amp;= 14 \\\\\n\\\\\nb_1 &amp;= r = 14\\\\\na_1 &amp;= b = 18\\\\\n&amp;= (14) + 4\\\\\n&amp;= b_1 + r_1\\\\\nr_1 &amp;= 4\\\\\n\\\\\nb_2 &amp;=r_1 = 4\\\\\na_2 &amp;= b_1 = 14\\\\\n&amp;= (4+4+4)+2\\\\\n&amp;= 3b_2 + r_2\\\\\nr_2 &amp;= 2\\\\\n\\\\\nb_3 &amp;= r_2 = 2\\\\\na_3 &amp;= b_2 = 4\\\\\n&amp;=(2+2) + 0\\\\\nr_3 &amp;= 0\\\\\n\n\\end{aligned}<\/pre><\/div>\n\n\n\n<p>The algorithms stops at <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-97d9d003ff489e46eaed4c9d602dbae9_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#114;&#95;&#51;&#61;&#48;\" title=\"Rendered by QuickLaTeX.com\" height=\"15\" width=\"48\" style=\"vertical-align: -3px;\"\/> which means we successfully divided the last tile <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-d11f2cadbba6177eeab8e4d2c74271e7_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#97;&#95;&#51;\" title=\"Rendered by QuickLaTeX.com\" height=\"11\" width=\"16\" style=\"vertical-align: -3px;\"\/> with <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-ef5e0c80de86e7b70c0b6fe84ed0cdf5_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#114;&#95;&#50;\" title=\"Rendered by QuickLaTeX.com\" height=\"11\" width=\"15\" style=\"vertical-align: -3px;\"\/> (logistically stored in <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-f1671db5ba535ae3df5ba6c13b8237e0_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#98;&#95;&#51;\" title=\"Rendered by QuickLaTeX.com\" height=\"15\" width=\"15\" style=\"vertical-align: -3px;\"\/>) with no gaps left. <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-ef5e0c80de86e7b70c0b6fe84ed0cdf5_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#114;&#95;&#50;\" title=\"Rendered by QuickLaTeX.com\" height=\"11\" width=\"15\" style=\"vertical-align: -3px;\"\/> (or <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-f1671db5ba535ae3df5ba6c13b8237e0_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#98;&#95;&#51;\" title=\"Rendered by QuickLaTeX.com\" height=\"15\" width=\"15\" style=\"vertical-align: -3px;\"\/> is therefore the greatest common factor (divisor) that are shared by all the numbers involved all the way up to <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-0e55b0b3943237ccfc96979505679274_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#97;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"9\" style=\"vertical-align: 0px;\"\/> and <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-ad69adf868bc701e561aa555db995f1f_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#98;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"8\" style=\"vertical-align: 0px;\"\/>.<\/p>\n\n\n\n<p>This is the beauty of Euclid&#8217;s GCD algorithm: once the gap (remainder) is sliced small enough to evenly divide the tile (divisor) right before it, every term before it be can written in terms of integer multiples of the last number that divides the last tile without gap (no more remainder).<\/p>\n\n\n\n<p>In our example, <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-9753824a1c0669e0017f9739db4ff980_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#52;&#44;&#32;&#49;&#52;&#44;&#32;&#49;&#56;&#44;&#32;&#53;&#48;\" title=\"Rendered by QuickLaTeX.com\" height=\"17\" width=\"86\" style=\"vertical-align: -4px;\"\/> can be written as a multiple of <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-8c267d62c3d7048247917e13baec69a5_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#50;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"8\" style=\"vertical-align: 0px;\"\/>, aka <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-ef5e0c80de86e7b70c0b6fe84ed0cdf5_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#114;&#95;&#50;\" title=\"Rendered by QuickLaTeX.com\" height=\"11\" width=\"15\" style=\"vertical-align: -3px;\"\/> because integer multiples of numbers that are already integer multiples of <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-ef5e0c80de86e7b70c0b6fe84ed0cdf5_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#114;&#95;&#50;\" title=\"Rendered by QuickLaTeX.com\" height=\"11\" width=\"15\" style=\"vertical-align: -3px;\"\/> can be written in terms of a larger integer multiple of <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-ef5e0c80de86e7b70c0b6fe84ed0cdf5_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#114;&#95;&#50;\" title=\"Rendered by QuickLaTeX.com\" height=\"11\" width=\"15\" style=\"vertical-align: -3px;\"\/>. This is why quotients do not matter in the Euclid GCD algorithm:<\/p>\n\n\n\n<div class=\"wp-block-katex-display-block katex-eq\" data-katex-display=\"true\"><pre>\\begin{aligned}\nb_2 &amp;= 2r_2\\\\\n4 &amp;= (2+2) \\\\\n\\\\\nb_1 &amp;= 3b_2 + r_2\\\\\n&amp;= 3(2r_2) + r_2\\\\\n&amp; = 7r_2\\\\\n14 &amp;= [(4+4+4)+2] \\\\\n&amp;=  [(2+2)+(2+2)+(2+2)+2] \\\\\n\n\\\\\nb &amp;= b_1 + r_1\\\\\n&amp;=7r_2 + 2r_2\\\\\n&amp;=9r_2\\\\\n18 &amp;= 14 + 4 \\\\\n&amp;=  [(4+4+4)+2] + 4 \\\\\n&amp;=  [(2+2)+(2+2)+(2+2)+2]+[(2+2)] \\\\\n\\\\\na &amp;= 2b + r\\\\\n&amp;=2(9r_2) + 7r_2\\\\\n&amp;= 25r_2\\\\\n50 &amp; = 18 + 18 + 14 \\\\\n&amp;= [(2+2)+(2+2)+(2+2)+2]+[(2+2)] \\cdots \\\\\n&amp;+ [(2+2)+(2+2)+(2+2)+2]+[(2+2)] \\cdots \\\\\n&amp;+ [(2+2)+(2+2)+(2+2)+2]\n\\end {aligned}<\/pre><\/div>\n\n\n\n<p>The spirit of the algorithm is that every time we see a gap, we fill it with a small tile that&#8217;s exactly the gap size, and attempt to replace the last tile by covering it in terms of the new smaller tile (that was used to fill the gap). We are recursively slicing the last tile with the gaps produced until there are no gaps left. Once you find the GCD tile, you can replace all the bigger tiles before in terms of it with no gaps.<\/p>\n\n\n\n<p>There&#8217;s an interesting perspective of using the Euclid GCD algorithm to solve <a rel=\"noreferrer noopener\" href=\"https:\/\/crypto.stanford.edu\/pbc\/notes\/numbertheory\/euclid.html\" target=\"_blank\">Diophantine Equations<\/a> (integer written as a linear combination of integers with integer coefficients): turns if <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-5214b37d702dddb0b65242ec8abf41fd_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#120;&#61;&#49;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"42\" style=\"vertical-align: 0px;\"\/> in <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-32900b83a1f005e4c8f35becb128d08d_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#99;&#61;&#97;&#120;&#45;&#98;&#121;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"89\" style=\"vertical-align: -4px;\"\/> is the same as writing <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-a97adadd89cf8180e6ba20a02e89dbff_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#97;&#32;&#61;&#32;&#98;&#121;&#43;&#114;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"80\" style=\"vertical-align: -4px;\"\/>. We can flip the sign of <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-38461fc041e953482219abf5d4cce1cb_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#121;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"9\" style=\"vertical-align: -4px;\"\/> by saying substituting <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/ql-cache\/quicklatex.com-2f02f6bd6435228aa1b4a02b1742e41b_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#121;&#39;&#61;&#45;&#121;\" title=\"Rendered by QuickLaTeX.com\" height=\"18\" width=\"61\" style=\"vertical-align: -4px;\"\/>.<\/p>\n\n\n\n<p>In summary, <\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Euclid GCD&#8217;s algorithm is sub-dividing the last (or any one) large tile (last divisor) with the gap (last remainder) until there are no gaps left. Then any bigger tiles up the chain can be expressed as an integer multiple of the last piece (the smallest piece searched so far) that fills the last gap.<\/p>\n<\/blockquote>\n\n\n\n<p>The first large tile is of course the smaller of the two numbers involved in the gcd calculation.  The larger of the two number is the floor to be covered.<\/p>\n\n\n\n<p>The other observation is that when you see the remainder being 1, you already know the two numbers are relatively prime. The last step to get the remainder to 0 is redundant (because it&#8217;s a guaranteed last step). <\/p>\n\n\n\n<p>The other observation is that subdividing the last big tile (divisor) with the last gap (remainder) till it&#8217;s evenly divided chains up, because everything is an integer multiple of the smallest piece that evenly divides the gap (remainder) and the last big tile (divisor), therefore the algorithm is recursive.<\/p>\n\n\n\n<div class=\"wp-block-katex-display-block katex-eq\" data-katex-display=\"true\"><pre>\\gcd(r_1,r_2) = \\gcd(r_2, r_3) = ... = \\gcd(r_{n-1}, r_n)<\/pre><\/div>\n\n\n\n<p>But this kind of recursion is not mandatory. It&#8217;s a <a href=\"https:\/\/xlinux.nist.gov\/dads\/HTML\/tailRecursion.html\">tail recursion<\/a>* that can be <a href=\"https:\/\/wonghoi.humgar.com\/blog\/programming-concepts-tail-recursion\/\" data-type=\"link\" data-id=\"https:\/\/wonghoi.humgar.com\/blog\/programming-concepts-tail-recursion\/\">unrolled<\/a> into iterations (looping), either by the compiler or the programmer, which is what we initially did.<\/p>\n<div class=\"pvc_clear\"><\/div><p id=\"pvc_stats_3130\" class=\"pvc_stats all  \" data-element-id=\"3130\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p><div class=\"pvc_clear\"><\/div>","protected":false},"excerpt":{"rendered":"<p>I was a little embarrassed that I&#8217;ve never came across Euclid&#8217;s GCD algorithm until years after I graduated with Math and Engineering degrees. The descriptions I&#8217;ve found online (especially Wikipedia) are convoluted and confusing, and the mechanical description of the &hellip; <a href=\"https:\/\/wonghoi.humgar.com\/blog\/2021\/11\/21\/easiest-way-to-remember-euclid-gcd-algorithm-laying-tiles\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_3130\" class=\"pvc_stats all  \" data-element-id=\"3130\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[20,46],"tags":[],"class_list":["post-3130","post","type-post","status-publish","format-standard","hentry","category-computer-science","category-layman-mathematics"],"_links":{"self":[{"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/posts\/3130","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/comments?post=3130"}],"version-history":[{"count":53,"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/posts\/3130\/revisions"}],"predecessor-version":[{"id":5206,"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/posts\/3130\/revisions\/5206"}],"wp:attachment":[{"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/media?parent=3130"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/categories?post=3130"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/tags?post=3130"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}