def GCD(a,b):
maxVal = max(a,b)
minVal = min(a,b)
remain = maxVal % minVal
if(remain == 0 ):
return minVal
return GCD(minVal, remain)
def LCM(a,b):
gcd = GCD(a,b)
return int(a * b / gcd)
def solution(arr):
answer = 0
lcm = -1
length = len(arr)
if(length == 1):
return arr[0]
lcm = LCM(arr[0],arr[1])
for i in range(2, len(arr)):
lcm = LCM(lcm, arr[i])
return lcm