Problems
Least Common Multiple
Least Common Multiple
The least common multiple (LCM) of a set of positive integers is the smallest positive integer which is divisible by all the numbers in the set. For example, the LCM of 5, 7 and 15 is 105.
You need to find the LCM of m given positive integers.
Input
The first line contains the number of tests. Each test case is a single line of the form mn1 n2 n3 ... nm
, where m (1 ≤ m ≤ 100) is the number of integers and n1
, ..., nm
are positive integers. All integers will be positive and lie within the range of a 32-bit integer.
Output
For each test case print in a single line the LCM of given m positive integers. All results will lie in the range of a 32-bit integer.
Input example #1
2 3 5 7 15 6 4 10296 936 1287 792 1
Output example #1
105 10296