Problem:
Least Common Multiple Find the least common multiple (LCM) of given n integers. Input  n  a 1  a 2 ... a n   n is given in the first line. Then, n integers are given in the second line. Output Print the least common multiple of the given integers in a line. Constraints  2 ≤ n ≤ 10  1 ≤ a i ≤ 1000  Product of given integers a i ( i = 1, 2, ... n ) does not exceed 2 31 -1  Sample Input 1 3
3 4 6 Sample Output 1 12 Sample Input 2 4
1 2 3 5 Sample Output 2 30

Solution (Python):



def gcd(n1, n2):
    if n1 < n2:
        n1, n2 = n2, n1

    if n1 == n2 or n2 == 0:
        return n1
    n1, n2 = n2, (n1 % n2)
    return gcd(n1, n2)


def lcm(n1, n2):
    return n1*n2//gcd(n1, n2)


def multi_lcm(numbers_list):
    if len(numbers_list) == 2:
        return lcm(numbers_list[0], numbers_list[1])
    elif len(numbers_list) > 2:
        numbers_list2 = [lcm(numbers_list[0], numbers_list[1])]
        numbers_list2.extend(numbers_list[2:])
        return multi_lcm(numbers_list2)


if __name__ == '__main__':
    n = int(input())
    number_list = list(map(int, input().split()))
    print(multi_lcm(number_list))

Solution (Python):

from functools import reduce
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def gcd(a, b):
    """
    return gcd of a,b
    ユークリッド
    """
    while b:
        a, b = b, a % b
    return a


def list_gcd(l):
    """
    l: list
    l のgcd を返す
    """
    return reduce(gcd, l)


def lcm(a, b):
    """
    a,bの最小公倍数
    """
    return a*b//gcd(a, b)


def list_lcm(l):
    """
    l:list
    lのlcmを返す
    """
    return reduce(lcm, l)


n = int(input())
l = list(map(int, input().split()))
print(list_lcm(l))

Solution (Python):
import math,functools as ft
lcm=lambda x,y:x*y//math.gcd(x,y)
print(ft.reduce(lcm,map(int,open(0).read().split()[1:])))

Solution (Python):
def gcd(a, b):
    if a < b:
        a, b = b, a
    while b:
        a, b = b, a%b
    return a

def lcm(a, b):
	return a * b // gcd (a, b)

n = int(input())
A = list(map(int, input().split()))

ans = 1
for a in A:
    ans = lcm(ans, a)
print(ans)

Solution (Python):
import fractions
n=int(input())
a=list(map(int, input().split()))
c=a[0]
for i in range(n):
  c=c*a[i]//fractions.gcd(c,a[i])
print(c)

Solution (Python):
import sys

def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a
    
def lcm(a, b):
    return a * b / gcd(a, b)
    
def lcm_array(arr):
    return reduce(lambda cur, x: lcm(cur, x), arr, arr[0])
    

    
if __name__ == '__main__':
    n = sys.stdin.readline()
    n = int(n)
    arr = sys.stdin.readline()
    arr = map(lambda x: int(x), arr.split())
    
    sys.stdout.write(str(lcm_array(arr)) + '\n')

Solution (Python):
import math
def sieve(n):
    p = [1] * (n + 1)
    p[0] = p[1] = 0
    
    for i in range(math.ceil((n + 1) ** 0.5)):
        if p[i]:
            for j in range(2 * i, len(p), i):
                p[j] = 0
    return p

from itertools import compress, count
def prime_factor(n):
    p = sieve(int(n ** 0.5))
    factor = []
    for pi in compress(count(0), p):
        while n % pi == 0:
            n //= pi
            factor.append(pi)

    if n != 1:
        factor.append(n)
    return factor

from collections import Counter
from sys import stdin
readline = stdin.readline

n = int(readline())
c =[Counter(prime_factor(ai)) for ai in map(int, readline().split())]
s = set()
for ci in c:
    s.update(ci.keys())

ret = 1
for i in [i ** max(ci[i] for ci in c) for i in s]:
    ret *= i
print(ret)

Solution (Python):
def gcd(m,n):  
    while m % n > 0:
        m, n = n, m % n
    else:
        return n
        
def gen_lcm_list(a):
    '''return a shorter list'''
    b = []
    for i in range(len(a)-1):
        b.append(a[i]*a[i+1]/gcd(a[i],a[i+1]))
    return b

n = int(raw_input())
a = map(int,raw_input().split())
while len(a) > 1:
    a = gen_lcm_list(a)
print a[0]

Solution (Python):
def gcd(a, b):
    if a < b: a, b = b, a
    while b:
        t = a / b
        a -= b * t
        a, b = b, a
    return a
def lcm(a, b):
    return a * b / gcd(a, b)
n = input()
print reduce(lambda a, b:lcm(a, b), map(int, raw_input().split()))

Solution (Python):
def gcd(a, b):
    if b == 0: return a
    else: return gcd(b, a % b)
def lcm(a, b):
    return a * b / gcd(a, b)
n = input()
print reduce(lambda a, b:lcm(a, b), map(int, raw_input().split()))

Solution (Python):
from math import sqrt, floor
from collections import deque
from functools import reduce
from operator import mul


def divide(p):
    global a, lcm, limit

    c, d, f = a.copy(), set(), False
    while True:
        b = set(i for i in c if not (i % p))
        d |= c - b
        if not b:
            a = d
            break
        lcm.append(p)
        c = set(i // p for i in b)
        f = True
    if f:
        limit = floor(sqrt(max(a)))


n, a = int(input()), set(map(int, input().split()))
p, lcm, limit = 3, deque(), floor(sqrt(max(a)))

divide(2)

while p <= limit:
    divide(p)
    p += 2

print(reduce(mul, lcm, 1) * reduce(mul, a, 1))

Solution (Python):



import fractions


def lcm(a, b):
    return a * b // fractions.gcd(a, b)


def lcms(ns):
    l = len(ns)
    assert l > 1
    if l == 2:
        return lcm(*ns)
    else:
        a = ns.pop()
        return lcm(a, lcms(ns))


if __name__ == "__main__":
    _ = int(input())
    print(lcms(list(map(int, input().split()))))

Solution (Python):
import math

k = input()
a = map(int, raw_input().split())

prime = []

m = int(math.sqrt(1000))
for i in range(m+1):
    prime.append(True)

prime[0] = False
prime[1] = False

for i in range(2, int(math.sqrt(m))):
    if not prime[i]:
        continue
    else:
        for j in range(i+1, int(math.sqrt(m))):
            if j % i == 0:
                prime[j] = False

lcm = {}

for n in a:
    s = []
    i = 2
    num = n
    while True:
        if i == int(math.sqrt(num))+1:
            s.append(str(n))
            break
        if not prime[i] or n % i != 0:
            i += 1
            continue

        if n % i == 0:
            s.append(str(i))
            n /= i
            if n == 1:
                break
    tmp_dict = {}


    for c in s:
        if not c in tmp_dict.keys():
            tmp_dict[c] = 1
        else:
            tmp_dict[c] += 1
    for key in tmp_dict.iterkeys():
        if not key in lcm.keys():
            lcm[key] = tmp_dict[key]
        elif lcm[key] < tmp_dict[key]:
            lcm[key] = tmp_dict[key]

L = 1
for key in lcm.iterkeys():
    if lcm[key] != 0:
            L *= int(key) ** lcm[key]

print "%d" % L

Solution (Python):
def gcd(a, b):
    
    while b > 0:
        a, b = b, a % b
    return a


def lcm(a, b):
    
    return a * b // gcd(a, b)

n = int(input())
a = list(map(int, input().split()))
ans = a[0]
for i in range(1,n):
    ans = lcm(ans, a[i])
print(ans)

Solution (Python):
import functools

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b)

def lcm(a, b):
    return a * b // gcd(a, b)



n = int(input())
ns = map(int, input().split())
print(functools.reduce(lcm, ns))

Solution (Python):
n = input()
nums = map(int,raw_input().split())
nums = sorted(nums)
i=n-2
x=1
while True:
    if i<0:
        break
    tmp =nums[n-1]*x 
    if tmp%nums[i]==0:
        i-=1
    else:
        x+=1
        i=n-2
print tmp

Solution (Python):
n = input()
nums = map(int,raw_input().split())
x = 2
checklist = [0 for i in xrange(n)]
table = []
while x<=max(nums):
    i=0
    while i<n:
        if nums[i]%x==0:
            checklist[i]=0
            nums[i] = nums[i]/x
        else:
            checklist[i]=1
        i+=1
    if 0 in checklist:
        table.append(x)
    else:
        x+=1
ans = 1


if len(table)==0:
    for num in nums:
        ans *= num
else:
    for num in nums:
        ans *= num
    for y in table:
        ans *= y
print ans

Solution (Python):
def gcd(a,b):
    if b==0:
        return a
    return gcd(b,a%b)

def lcm(a,b,g):
    return a*b/g

n=input()
x=map(int,raw_input().split())
ans=[x[0]]
for i in xrange(n-1):
    g=gcd(ans[i],x[i+1])
    ans.append(lcm(ans[i],x[i+1],g))
print(ans[n-1])

Solution (Python):
def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n
def lcm(m, n):
    return m*n/gcd(m, n)
input()
print reduce(lcm, map(int, raw_input().split()))

Solution (Python):
def gcd(a,b):
    if a<b:
        tmp = a
        a = b
        b = tmp
    while(b>0):
        n = a%b
        a = b
        b = n
    return a

def lcm(a,b):
    return a*b//gcd(a,b)

n = int(input())
s = input().split()
arr = []
for i in range(n):
    arr.append(int(s[i]))
a = arr[0]
for i in range(1,n):
    a = lcm(a, arr[i])
print(a)

Solution (Python):
def get_primes(n):
  lst = []
  for x in xrange(2, n+1):
    is_prime = True
    for i in xrange(len(lst)):
      if x % lst[i] == 0:
        is_prime = False
        break
    if is_prime:
      lst.append(x)
  return lst

primes = get_primes(1000)
n = int(raw_input())
a = map(int, raw_input().split())
mul_list = {}
for i in xrange(n):
  ai = a[i]
  for j in xrange(len(primes)):
    counter = 0
    while True:
      if ai % primes[j] == 0:
        ai = ai / primes[j]
        counter += 1
      else:
        break
    if counter > 0:
      if primes[j] in mul_list:
        mul_list[primes[j]] = max(mul_list[primes[j]], counter)
      else:
        mul_list[primes[j]] = counter

ans = 1
for k,v in mul_list.items():
  ans *= k ** v
print ans

Solution (Python):



"""
input:
4
1 2 3 5

output:
30
"""

import sys
from functools import reduce


def gcd(x, y):
    if x < y:
        x, y = y, x

    while y > 0:
        r = x % y
        x = y
        y = r

    return x


def lcm(a, b):
    return a * b // gcd(a, b)


def solve(_n_list):
    return reduce(lcm, _n_list)


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    cnt = int(_input[0])
    n_list = list(map(int, _input[1].split()))
    print(solve(n_list))

Solution (Python):



"""
input:
4
1 2 3 5

output:
30
"""

import sys
from functools import reduce


def gcd(x, y):
    if x < y:
        x, y = y, x

    while y > 0:
        r = x % y
        x = y
        y = r

    return x


def lcm(a, b):
    return a * b // gcd(a, b)


def solve(_n_list):
    return reduce(lcm, _n_list)


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    cnt = int(_input[0])
    n_list = tuple(map(int, _input[1].split()))
    print(solve(n_list))

Solution (Python):



"""
input:
4
1 2 3 5

output:
30
"""

import sys
from functools import reduce
from operator import mod


def gcd(x, y):
    if x < y:
        x, y = y, x

    while y > 0:
        r = mod(x, y)
        x = y
        y = r

    return x


def lcm(a, b):
    return a * b // gcd(a, b)


def solve(_n_list):
    return reduce(lcm, _n_list)


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    cnt = int(_input[0])
    n_list = tuple(map(int, _input[1].split()))
    print(solve(n_list))

Solution (Python):



"""
input:
4
1 2 3 5

output:
30
"""

import sys
import fractions
from functools import reduce


def gcd(x, y):
    if x < y:
        x, y = y, x

    while y > 0:
        r = x % y
        x = y
        y = r

    return x


def lcm(a, b):
    return a * b // fractions.gcd(a, b)


def solve(_n_list):
    return reduce(lcm, _n_list)


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    cnt = int(_input[0])
    n_list = tuple(map(int, _input[1].split()))
    print(solve(n_list))

Solution (Python):



"""
input:
4
1 2 3 5

output:
30
"""

import sys
from functools import reduce


def gcd(x, y):
    if x < y:
        x, y = y, x

    while y > 0:
        r = x % y
        x = y
        y = r

    return x


def lcm(a, b):
    return a * b // gcd(a, b)


def solve(_n_list):
    return reduce(lcm, _n_list)


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    cnt = int(_input[0])
    n_list = tuple(map(int, _input[1].split()))
    print(solve(n_list))

Solution (Python):



"""
input:
4
1 2 3 5

output:
30
"""

import sys
from functools import reduce


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd(a, b)


def solve(_n_list):
    return reduce(lcm, _n_list)


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    cnt = int(_input[0])
    n_list = tuple(map(int, _input[1].split()))
    print(solve(n_list))

Solution (Python):

def gcd(a, b):
    if b == 0: return a
    return gcd(b, a % b)

def lcm(a, b):
    return a * b / gcd(a, b)

n = int(input())
a = list(map(int,input().split()))
p = lcm(a[0],a[1])
for i in range(n):
    p = lcm(p,a[i])
print(int(p))

Solution (Python):
def gcd(a,b):
    while b:a,b=b,a%b
    return a

def lcm(a,b):
    return a//gcd(a,b)*b

input()
a=list(map(int,input().split()))
b=1
for i in a:
    b=lcm(b,i)
print(b)

Solution (Python):
n = int(input())
number = list(map(int,input().split()))

def function(n):
    a = []
    if n < 2:
        return a
    while n%2 ==0:
        a.append(2)
        n = n//2
    i = 3
    while i*i <= n:
        if n%i ==0:
            a.append(i)
            n = n//i
        else:
            i += 2
    if n > 1:
        a.append(n)
    return a

diction = {}
for i in range(n):
    prime_factor = function(number[i])
    for k in prime_factor:
        a = prime_factor.count(k)
        if k not in diction:
            diction[k] = a
        elif diction[k] < a:
            diction[k] = a
ans= 1            
for a in diction:
    ans *= a**diction[a]
    
print(ans)

Solution (Python):
n = int(input())
a = [int(i) for i in input().split()]

def gcd(x, y):
    while(y):
        x, y = y, x%y
    return x

def lcm(x, y):
    lcm = (x*y)//gcd(x,y)
    return lcm

ans = 1
for i in a:
    ans = lcm(ans, i)
    
print(ans)

Solution (Python):
import sys
from fractions import gcd
from functools import reduce

def solve():
    n = int(input())
    a = [int(i) for i in input().split()]

    ans = reduce(lcm, a, 1)

    print(ans)

def lcm(a, b):
    return a * b // gcd(a, b)

if __name__ == '__main__':
    solve()

Solution (Python):
def GCD(x,y):
    r = x%y
    if r == 0:
        return y
    else:
        return GCD(y,r)


n = int(input())
list1 = list(map(int,input().split()))
result = list1[0]
for i in list1[1:]:
    result = result*i/GCD(i,result)

print(int(result))

Solution (Python):
def gcd(a, b):
    if a % b == 0:
        return b
    else:
        return gcd(b, a % b)

def lcm(a, b):
    return int(a * b / int(gcd(a, b)))

def solve():
    n = input()
    nums = list(map(int, input().split()))
    c_m = lcm(nums[0], nums[1])
    for n in nums[2:]:
        c_m = lcm(c_m, n)
    print(c_m)

solve()

Solution (Python):
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // int(gcd(a, b))

def solve():
    n = input()
    nums = list(map(int, input().split()))
    
    ans = 1
    for n in nums:
        ans = lcm(n, ans)
        
    print(ans)

solve()

Solution (Python):
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // int(gcd(a, b))

import functools

def solve():
    n = input()
    nums = map(int, input().split())
    print(functools.reduce(lcm, nums))

solve()

Solution (Python):


import itertools
import sys, math, os


PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input2.txt", "rt")


def get_factors(n):
    f = 2
    increments = itertools.chain([1,2,2], itertools.cycle([4,2,4,2,4,6,2,6]))
    for incr in increments:
        if f*f > n:
            break
        while n % f == 0:
            yield f
            n //= f
        f += incr
    if n > 1:
        yield n

N = int(input())
max_powers = {}
for n in [int(_) for _ in input().split()]:
    powers = {}
    for f in get_factors(n):
        powers[f] = powers.get(f, 0) + 1
    for p in powers:
        max_powers[p] = max(powers[p], max_powers.get(p, 0))
lcm = 1
for p in max_powers:
    lcm *= p**max_powers[p]

print(lcm)

Solution (Python):
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd(a, b)

import functools

def solve():
    n = input()
    nums = map(int, input().split())
    print(functools.reduce(lcm, nums))

solve()

Solution (Python):
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd(a, b)

import functools

def solve():
    n = input()
    nums = map(int, input().split())
    print(functools.reduce(lcm, nums))

solve()

Solution (Python):
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd(a, b)

import functools

def solve():
    n = input()
    nums = map(int, input().split())
    print(functools.reduce(lcm, nums))

solve()

Solution (Python):
n = int(input())
a = map(int, input().split())
result = a.__next__()

for nb in a:
    na = result
    result *= nb
    while nb > 0:
        na, nb = nb, na%nb
    result //= na

print(result)

Solution (Python):
def gcd(x,y):
    p=min(x,y)
    q=max(x,y)
    while p != q:
        if q > p:
            q = q - p
        else:
            p = p - q
    return q

c=0
n=int(input())
a=sorted(set(list(map(int, input().split()))))
b=[]
while len(a) > 1:
    p=a[0]
    q=a[1]
    g=gcd(p,q)
    if g !=0:
        a.append(p*q//g)
    a.pop(0)
    a.pop(0)
    a=sorted(a)
print(*a)

Solution (Python):
def gcd(x,y):
    p=min(x,y)
    q=max(x,y)
    while p != q:
        if q > p:
            q = q - p
        else:
            p = p - q
    return q

n=int(input())
a=sorted(set(list(map(int, input().split()))))
while len(a) > 1:
    p=a[0]
    q=a[1]
    g=gcd(p,q)
    a.append(p*q//g)
    a.pop(0)
    a.pop(0)
    a=sorted(a)
print(*a)

Solution (Python):
import math
n=int(input())-1
a=list(map(int,input().split()))
for i in[0]*n:
 x,y=a.pop(),a.pop()
 a+=[x*y//math.gcd(x,y)]
print(*a)

Solution (Python):
import math
n=int(input())-1
a=list(map(int,input().split()))
for i in[0]*n:
 x,y=a.pop(),a.pop()
 a+=[x*y//math.gcd(x,y)]
print(*a)

Solution (Python):
import math
input();b=1
for a in list(map(int,input().split())):b=a*b//math.gcd(a,b)
print(b)

Solution (Python):
def gcd(a,b):
    while b:a,b=b,a%b
    return a
 
def lcm(a,b):
    return a//gcd(a,b)*b
 
input()
a=list(map(int,input().split()))
b=1
for i in a:
    b=lcm(b,i)
print(b)

Solution (Python):
def gcd(a, b):
    x, y = [a, b] if a > b else [b, a]
    while y:
        x, y = y, x%y
    return x

def lcm(a, b):
    return a*b // gcd(a, b)

n = int(input())
A = [int(x) for x in input().split(' ')]

tmp = A[0]
for i in range(1, n):
    tmp = lcm(tmp, A[i])

print(tmp)

Solution (Python):
def gcd (a,b):
	if a < b:
		a,b = b,a
	return a if b == 0 else gcd(b,a%b)

n = int(input())
a = list(map(int,input().split(" ")))
ans = 1

for i in range(n):
	ans *= (a[i]//gcd(ans,a[i]))

print(ans)

Solution (Python):
from math import gcd
from functools import reduce
def lcm(a, b):
    return a*b//gcd(a, b)

n = int(input())
a = [int(i) for i in input().split()]
print(reduce(lcm, a))

Solution (Python):
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

n = int(raw_input())
a = map(int, raw_input().split())
l = a[0]

for i in range(1,len(a)):
    b = a[i]
    g = gcd(l,b)
    l = l*b/g
print l

Solution (Python):
def gcd(a,b):
    while True:
        if a<b:
            a,b=b,a
        amari=a%b
        if amari==0:
            break
        else:
            a,b=b,amari
    return(b)

n=int(input())
c=list(map(int,input().split()))
for i in range(n-1,0,-1):
    c[i-1]=int(c[i]*c[i-1]/gcd(c[i],c[i-1]))
print(c[0])

Solution (Python):
def gcd(a,b):
    while b:
        a,b=b,a%b
    return a

def lcm(a,b):
    return a//gcd(a,b)*b

input()
a=list(map(int,input().split()))
b=1
for i in a:
    b=lcm(b,i)
print(b)

Solution (Python):
import math
n=int(input())
a=list(map(int,input().split()))
ans=a[0]
for i in range(1,n):
    ans=ans*a[i]//math.gcd(ans,a[i])
print(ans)

Solution (Python):
import math
n=int(input())
a=list(map(int,input().split()))
x=a[0]
for i in range(1,n):
    x=x*a[i]//math.gcd(x,a[i])
print(x)

Solution (Python):
import math
from functools import reduce

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

n = int(input())

a = list(map(int,input().split()))

print(lcm(*a))

Solution (Python):
import math
i = int(input())
line = list(map(int,input().split()))
n = line[0]
for l in range(1,i):n = int(n * line[l] / math.gcd(n,line[l]))
print(n)

Solution (Python):
import math
input();b = 1
for i in list(map(int,input().split())):
    b = i*b//math.gcd(i,b)
print(b)

Solution (Python):
import fractions
n = int(input())
a = list(map(int, input().split()))
ans = a[0]
for i in range(1, n):
    ans = ans * a[i] // fractions.gcd(ans, a[i])
print(ans)

Solution (Python):
from math import gcd
from functools import reduce
def lcm(x, y):
  return x * y // gcd(x, y)
n = int(input())
alst = list(map(int, input().split()))
print(reduce(lcm, alst))

Solution (Python):
def gcd(a,b):
    while b:a,b=b,a%b
    return a

def lcm(a,b):
    return a//gcd(a,b)*b

input()
a=list(map(int,input().split()))
b=1
for i in a:
    b=lcm(b,i)
print(b)

Solution (Python):
import math
from functools import reduce
def lcm(x,y):
    return (x*y)//math.gcd(x,y)
n = int(input())
a = list(map(int,input().split()))
print(reduce(lcm,a))

Solution (Python):
import math
n=int(input())
A=list(int(a) for a in input().split())
ans = A[0]

for i in range(1, n) :
    ans = ans * A[i] // math.gcd(ans, A[i])
    
print(ans)

Solution (Python):
import fractions
n = int(input())
a = input().split()
l = list(map(int,a))

ans = l[0]
for i in range(1,n):
    ans = ans * l[i] // fractions.gcd(ans,l[i])
print(ans)

Solution (Python):
from functools import reduce
from math import gcd
input()
A = list(map(int, input().split()))

def lcm(a, b):
    return a*b//gcd(a, b)

ans = reduce(lcm, A)
print(ans)

Solution (Python):



from math import gcd
from functools import reduce

n=int(input())
a=list(map(int,input().split()))

def lcm(x,y):
    return x*y//gcd(x,y)

print(reduce(lcm,a))

Solution (Python):



def gcd(x, y):
   if x < y:
      x, y = y, x
   if x % y == 0:
      return y
   else:
      return gcd(y, x % y)

n = int(input())
A = list(map(int, input().split()))

l = A[0]
for i in range(1, n):
   l = l * A[i] / gcd(l, A[i])
print(int(l))

Solution (Python):

def gcd(a,b):
    while b:a,b=b,a%b
    return a
 
def lcm(a,b):
    return a//gcd(a,b)*b
 
input()
a=list(map(int,input().split()))
b=1
for i in a:
    b=lcm(b,i)
print(b)

Solution (Python):
import math
n = int(input())
x = 1
for y in list(map(int,input().split())):
    x = y*x // math.gcd(y,x)
print(x)

Solution (Python):
import fractions
n=int(input())
x=list(map(int, input().split()))   
y=x[0]

for i in range(1,n):
    y = y * x[i] // fractions.gcd(y, x[i])
print(y)

Solution (Python):
import math
def LCM(x, y):
    return (x * y) // math.gcd(x, y)
n = int(input())
a = list(map(int,input().split()))
lcm = 1
for ai in a:
  lcm =LCM(ai,lcm)
print(lcm)

Solution (Python):


def gcd(a, b) :
    while True :
        if a < b :
            a, b = b, a
        amari = a % b
        if amari == 0 :
            break
        else :
            a, b = b, amari
    return(b)

n = int(input())
c = list(map(int, input().split()))
for i in range(n-1, 0, -1) :
    c[i-1] = int(c[i] * c[i-1] / gcd(c[i], c[i-1]))
print(c[0])

Solution (Python):
import sys
import math


def main2():
    n = int(input())
    A = [int(x) for x in sys.stdin.readline().rstrip().split()]

    lcm = 1
    for a in A:
        lcm = a * lcm // math.gcd(a, lcm)

    print(lcm)


main2()

Solution (Python):
from math import gcd
a=1
n=int(input())
l=list(map(int,input().split()))
for i in l:
    a=a*i//gcd(a,i)
print(a)

Solution (Python):
from fractions import gcd
def lcm(a,n):
    x = a[0]
    for i in range(1,n):
        x = (x * a[i]) // gcd(x,a[i])
    return x
        
n = int(input())
a = list(map(int,input().split()))
print(lcm(a,n))

Solution (Python):
import sys
from math import gcd

input = sys.stdin.readline


def lcm(a, b):
    return (a * b) // gcd(a, b)


def main():
    N = int(input())
    A = list(map(int, input().split()))

    ans = 1
    for a in A:
        ans = lcm(ans, a)

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
import math
from functools import*
print(reduce(lambda a, b: a * b // math.gcd(a, b), map(int, open(0).read().split()[1:])))

Solution (Python):
import fractions
n = int(input())
a = list(map(int, input().split()))
ans = a[0]
for i in range(1, n):
  ans = ans * a[i] // fractions.gcd(ans, a[i])
print(ans)

Solution (Python):
import fractions

N = int(input())
data = list(map(int,input().split()))
x = data[0]
for i in range(1, N):
    x = x * data[i] // fractions.gcd(x, data[i])
print(x)

Solution (Python):
import math
n = int(input())
a = list(map(int,input().split()))
x = a[0]
for i in range(1,n):
    x = x * a[i] // math.gcd(x,a[i])
print(x)

Solution (Python):
import math

def main(n):
	ans = 1
	lst = list(map(int, input().split()))
	for i in lst:
		ans = ans * i // math.gcd(ans,i)
	print(ans)
main(int(input()))

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

print(lcm(a))

Solution (Python):

import math
n = int(input())
a = list(map(int, input().split()))
x = a[0]
for i in range(1, n):
    x = x * a[i] // math.gcd(x, a[i])
print(x)

Solution (Python):
from math import gcd
a = int(input())  
b = list(map(int, input().split())) 
lcm = b[0]  
for m in b[1:]:
    lcm = int((lcm*m)/gcd(lcm, m)) 
print(lcm)

Solution (Python):
import math
from functools import reduce
n=int(input())
z=list(map(int,input().split()))
def lcm_b(x,y):
    return (x*y)//(math.gcd(x,y))
def lcm(*z):
    return reduce(lcm_b,z,1)
print(lcm(*z))

Solution (Python):
import math
n=int(input())
a=list(map(int,input().split()))
b=a[0]
for i in range(1,n):
    b=b*a[i]//math.gcd(b,a[i])
print(b)

Solution (Python):
import fractions
n=int(input())
a=list(map(int,input().split()))
x=a[0]
for i in range(1,n):
    x=x*a[i]//fractions.gcd(x,a[i])
print(x)

Solution (Python):



import math
n = int(input())
b = 1
for a in list(map(int,input().split())):
    b = a*b // math.gcd(a,b)
print(b)

Solution (Python):
def gcd(a,b):
    while b:a,b=b,a%b
    return a

def lcm(a,b):
    return a//gcd(a,b)*b

input()
a=list(map(int,input().split()))
b=1
for i in a:
    b=lcm(b,i)
print(b)

Solution (Python):


import math

def main(n):
	ans = 1
	lst = list(map(int, input().split()))
	for i in lst:
		ans = ans * i // math.gcd(ans,i)
	print(ans)
main(int(input()))

Solution (Python):
def gcd(a,b):
    while b:a,b=b,a%b
    return a

def lcm(a,b):
    return a//gcd(a,b)*b

input()
a=list(map(int,input().split()))
b=1
for i in a:
    b=lcm(b,i)
print(b)

Solution (Python):
n=int(input())
def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

a = list(map(int,input().split()))
print(lcm(a))

Solution (Python):
import fractions
n = int(input())
a = list(map(int,input().split()))
ans = a[0]
for i in range(n):
    ans = ans * a[i] // fractions.gcd(ans, a[i])
print(ans)

Solution (Python):
import fractions
n = int(input())
a = list(map(int, input().split()))
ans = a[0]
for i in range(1, n):
    ans = ans * a[i] // fractions.gcd(ans, a[i])
print(ans)

Solution (Python):
import fractions

def lcm(a,b):
    return a*b//fractions.gcd(a,b)

N = int(input())
a = list(map(int,input().split()))
f = a[0]

for i in range(1,N):
    f = lcm(f,a[i])

print(f)

Solution (Python):
def gcd(a, b) :
    while True :
        if a < b :
            a, b = b, a
        amari = a % b
        if amari == 0 :
            break
        else :
            a, b = b, amari
    return(b)

n = int(input())
c = list(map(int, input().split()))
for i in range(n-1, 0, -1) :
    c[i-1] = int(c[i] * c[i-1] / gcd(c[i], c[i-1]))
print(c[0])

Solution (Python):
import fractions

n = int(input())
a = list(map(int, input().split()))
ans = a[0]

for i in range(1, n):
    ans = ans * a[i] // fractions.gcd(ans, a[i])

print(ans)

Solution (Python):
import math
n=int(input())
a=list(map(int,input().split()))
lcm=a[0]
for i in range(1,n):
    x=lcm
    y=a[i]
    lcm=(x*y)//math.gcd(x,y)
print(lcm)

Solution (Python):
import fractions
n = int(input())
a = input().split()
l = list(map(int,a))

ans = l[0]
for i in range(1,n):
    ans = ans * l[i] // fractions.gcd(ans,l[i])
print(ans)

Solution (Python):
import fractions
n=int(input())
a = list(map(int, input().split()))
ans = a[0]
for i in range(1, n):
    ans = ans * a[i] // fractions.gcd(ans, a[i])
print(ans)

Solution (Python):
import math
n=int(input())
a=list(map(int,input().split()))
a_s=list(set(a))
while len(a_s)!=1:
    gcd=math.gcd(a_s[-1],a_s[-2])
    lcm=int(a_s[-1]*a_s[-2]/gcd)
    a_s=a_s[:-2]
    a_s.append(lcm)
print(a_s[0])

Solution (Python):
import fractions
n = int(input())
a = list(map(int, input().split()))
ans = a[0]
for i in range(1, n):
   ans = ans * a[i] // fractions.gcd(ans, a[i])
print(ans)

Solution (Python):
import fractions as fra
n=int(input())
a=list(int(z) for z in input().split())
A=a[0]
for i in range(1,n):
    A=A*a[i]//fra.gcd(A,a[i])
print(A)

Solution (Python):
from math import gcd
n = int(input())
k = 1
for x in map(int, input().split()):
    k = k * x // gcd(k, x)
print(k)

Solution (Python):
import math
from functools import reduce
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

n=int(input())
l=list(map(int,input().split()))
    
print(reduce(lcm,l))

Solution (Python):
import fractions
A=int(input())
a = list(map(int, input().split()))
ans = a[0]
for i in range(A):
    ans = ans * a[i] // fractions.gcd(ans, a[i])
print(ans)

Solution (Python):
from math import gcd
n = int(input())
a = list(map(int,input().split()))
b = a[0]
for i in a[1:]:
    b = int(b*i/gcd(b, i))
print(b)

Solution (Python):
import math
from functools import reduce

def lcm_base(x,y):
    return (x*y)//math.gcd(x,y)
def lcm_list(numbers):
    return reduce(lcm_base,numbers,1)

n=int(input())
a=list(map(int,input().split()))
print(lcm_list(a))

Solution (Python):
import math
def keisan(x,y):
    z = (x[0]*x[1])//math.gcd(x[0],x[1])
    for i in range(y-2):
        z = (z*x[i+2])//math.gcd(z,x[i+2])
    return z
    
n = int(input())    
a = list(map(int,input().split()))
print(keisan(a,n))

Solution (Python):
import fractions
n = int(input())
a = list(map(int,input().split()))
ans = a[0]
for i in range(1,n):
    ans = ans * a[i] // fractions.gcd(ans, a[i])
print(ans)

Solution (Python):
import fractions

n = int(input())
lst = list(map(int,input().split()))
ans = lst[0]

for i in range(1,n):
    ans = ans * lst[i] // fractions.gcd(ans, lst[i])

print(ans)

Solution (Python):
import fractions
n=int(input())
l=list(map(int,input().split()))
a=l[0]
for i in range(1,n):
    a=a*l[i]//fractions.gcd(a,l[i])
print(a)

Solution (Python):
import fractions
n=int(input())
l=list(map(int,input().split()))

m=l[0]
for i in range(n):
    m=m*l[i]//fractions.gcd(m,l[i])
print(m)

Solution (Python):
from math import gcd
from functools import reduce


def get_LCM(l):
    def lcm(a, b):
        return (a * b) // gcd(a, b)

    return reduce(lcm, l, 1)


if __name__ == '__main__':
    n = int(input())
    l = list(map(int, input().split()))
    print(get_LCM(l))