Skip to content

Instantly share code, notes, and snippets.

@sigmavirus24
Created May 9, 2012 19:12
Show Gist options
  • Save sigmavirus24/2648112 to your computer and use it in GitHub Desktop.
Save sigmavirus24/2648112 to your computer and use it in GitHub Desktop.
Studying Fun
def gcd(a, b):
if a < b:
(a, b) = b, a
print euclidean_algorithm(a, b)
def euclidean_algorithm(a, b):
r = a % b
if r:
return euclidean_algorithm(b, r)
return b
# Was studying for a final exam for number theory
# and realized how simple this algorithm would be
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment