Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Euclid's Algorithm

DZone's Guide to

Euclid's Algorithm

·
Free Resource
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
Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}