一、最大公约数(greatest common divisor)
def gcd(a,b):
if b==0:
return a
return gcd(b,a%b)
二、最小公倍数(least common multiple)
def lcm(a,b):
if b==1:
return a
return a*b/gcd(a,b)
一、最大公约数(greatest common divisor)
def gcd(a,b):
if b==0:
return a
return gcd(b,a%b)
二、最小公倍数(least common multiple)
def lcm(a,b):
if b==1:
return a
return a*b/gcd(a,b)
转载于:https://www.cnblogs.com/xiaoningyu/p/10690777.html