This is a code sample to calculate the greatest common denominator of two integers.

 def gcd(a, b):
     while b != 0:
         (a, b) = (b, a%b)
     return a
 #For n>=2 integers
 def Euclid(*integers):
     if type(integers[0])==list or type(integers[0])==tuple:
 	integers = integers[0]
     if len(integers) == 2:
 	a,b = integers[0],integers[1]
 	while b != 0:
 		a,b = b, a%b
 	return a
 	return Euclid(integers[0],Euclid(integers[1:]))
Community content is available under CC-BY-SA unless otherwise noted.