Skip to content

Instantly share code, notes, and snippets.

@pgtwitter
Last active October 14, 2024 02:45
Show Gist options
  • Save pgtwitter/9074531bc2b8ae892c9bbfd1c43343b5 to your computer and use it in GitHub Desktop.
Save pgtwitter/9074531bc2b8ae892c9bbfd1c43343b5 to your computer and use it in GitHub Desktop.
greatest common divisor
# %%
def gcd(a, b):
a, b = (a, b % a) if a < b else (b, a % b)
return (a, b) if b == 0 else gcd(a, b)
gcd(3525, 4794)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment