Created
March 1, 2012 12:43
-
-
Save mildsunrise/1949619 to your computer and use it in GitHub Desktop.
Greatest Common Divisor (GCD), compressed
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
gcd={a,b->b?gcd(b,a%b):a} | |
mcm={a,b->a*b/gcd(a,b)} |
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): | |
return b?gcd(b,a%b):a | |
mcm=lambda a,b:a*b/gcd(a,b) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment