Skip to content

Instantly share code, notes, and snippets.

@mildsunrise
Created March 1, 2012 12:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mildsunrise/1949619 to your computer and use it in GitHub Desktop.
Save mildsunrise/1949619 to your computer and use it in GitHub Desktop.
Greatest Common Divisor (GCD), compressed
gcd={a,b->b?gcd(b,a%b):a}
mcm={a,b->a*b/gcd(a,b)}
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