from math import gcd

def solution(arr):
    answer = arr[0]
    # 배열을 순회하면서 이전까지의 최소공배수(answer)와 현재값(arr[i])의 최소공배수를 구해 answer 갱신
    for i in range(1, len(arr)):
        answer = answer * arr[i] // gcd(answer, arr[i])
    return answer


# test case
print(solution([2, 6, 8, 14]))
print(solution([1, 2, 3]))
ec31309ebcb0497a7110f9481de0f9e04df7ff97
<mask token>

<mask token>


def solution(arr):
    answer = arr[0]
    for i in range(1, len(arr)):
        answer = answer * arr[i] // gcd(answer, arr[i])
    return answer


<mask token>

<mask token>


def solution(arr):
    answer = arr[0]
    for i in range(1, len(arr)):
        answer = answer * arr[i] // gcd(answer, arr[i])
    return answer


print(solution([2, 6, 8, 14]))
print(solution([1, 2, 3]))

from math import gcd


def solution(arr):
    answer = arr[0]
    for i in range(1, len(arr)):
        answer = answer * arr[i] // gcd(answer, arr[i])
    return answer


print(solution([2, 6, 8, 14]))
print(solution([1, 2, 3]))

from math import gcd

def solution(arr):
    answer = arr[0]
    # 배열을 순회하면서 이전까지의 최소공배수(answer)와 현재값(arr[i])의 최소공배수를 구해 answer 갱신
    for i in range(1, len(arr)):
        answer = answer * arr[i] // gcd(answer, arr[i])
    return answer


# test case
print(solution([2, 6, 8, 14]))
print(solution([1, 2, 3]))