Join the DZone community and get the full member experience.Join For Free
Euclid(a, b) calculates the largest common denominator d, and returns it. Uses the well-known Euclid's algorithm.
def euclid(a, b): while b != 0: r = a % b a = b b = r return a
Opinions expressed by DZone contributors are their own.