a = 4b = 5# 更相减损法def func(a, b): if a == b or a == 1: return a a, b = b, a - b return func(a, b)a, b = max(a, b), min(a, b)# 求最大公约数print(func(a, b))# 求最小公倍数print(a * b / func(a, b))