Skip to content

Commit

Permalink
Euclidean algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
Liudmil Mitev committed Aug 13, 2011
1 parent 4959dd2 commit 90a7866
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions math/greatest_common_divisor.py
@@ -0,0 +1,10 @@
#!/usr/bin/env python

def greatest_common_divisor(m,n):
'''
Euclid's algorithm for finding the
greatest common divisor of m,n
'''
r = m % n
if r == 0: return n
else: return greatest_common_divisor(n, r)

0 comments on commit 90a7866

Please sign in to comment.