Extended Euclid for GCD
After GCD, I introduce you Extended Euclid algorithm to prove GCD of two integer numbers. I repeat, this algorithm only for proving purpose. So, in the end of the code you will only see it's proved oor not. It's said that GCD will fulfill equation below.
1 | s*a + t*b = gcd(a, b) |
Where s and t is integers. What I did in my program is finding value of s and t then I could prove that my GCD follows Extended Euclid. My codes could be forked here as extended_euclid.py file. Simply go to your terminal and change the directory to x0x folder and run python extended_euclid.py. The terminal console is like my illustration below:
Comments
Post a Comment
Write your comment here.