Skip to content

Instantly share code, notes, and snippets.

@andreipetre
Created February 11, 2014 20:23
Show Gist options
  • Save andreipetre/8943353 to your computer and use it in GitHub Desktop.
Save andreipetre/8943353 to your computer and use it in GitHub Desktop.
Calculate the greatest common divisor for two positive integers
def gcd(a, b):
while b > 0:
a, b = b, a % b
return a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment