output_description: Print the least common multiple of the given integers in a line.
input_description: n
      a1 a2 ... an
      
  
  n is given in the first line. Then, n integers are given in the second line.
attempt: 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)
  
problem_description: Least Common Multiple
  
    
  
  Find the least common multiple (LCM) of given n integers.
samples: [{"input": "3\n    3 4 6", "output": "12"}, {"input": "4\n    1 2 3 5", "output": "30"}]