题解 | #求最小公倍数#
求最小公倍数
https://www.nowcoder.com/practice/22948c2cad484e0291350abad86136c3
def fun1(x): dic={} for i in range(2,int(x**0.5+2)): while True: if x % i == 0: dic[i] = dic.get(i, 0) + 1 x = x // i else: break if x!=1: dic[x]=1 return dic in1=input().split() m,n=int(in1[0]),int(in1[1]) dic1,dic2=fun1(m),fun1(n) ls=list(dic1.keys()) ls.extend(dic2.keys()) ls=list(set(ls)) result=1 for x in ls: result*=x**max(dic1.get(x,0),dic2.get(x,0)) print(result)