#-*- encoding: utf-8 -*- def gcm(a, b): assert a > 0 and b > 0,'parameters must be greater than 0.' if a >= b: if a % b == 0: return b else: return gcm(b, a - b) else: return gcm(b, a) def lcm(a, b): assert a > 0 and b > 0,'parameters must be greater than 0.' return a * b / gcm(a, b)