Skip to content

Instantly share code, notes, and snippets.

@AdriDevelopsThings
Created May 22, 2023 17:23
Show Gist options
  • Save AdriDevelopsThings/d0c85908ebd7433fc5b6e99eb06554d2 to your computer and use it in GitHub Desktop.
Save AdriDevelopsThings/d0c85908ebd7433fc5b6e99eb06554d2 to your computer and use it in GitHub Desktop.
A recursive implementation of the gcd in python
def gcd(a, b):
r = a - (a // b) * b
if r == 0:
return b
return gcd(b, r)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment