Created
April 21, 2018 17:09
-
-
Save SharanSMenon/86b66d22b74e330046c91a3a12fa4045 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def gcd(a, b): | |
""" | |
An efficient algorithm to compute GCD \n | |
a is a number \n | |
b is the other number \n | |
no other arguments | |
""" | |
if b == 0: | |
return a | |
ap = a % b | |
return gcd(b, ap) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment