Least common multiple P96564


Statement
 

pdf   zip

thehtml

Write a program such that, given n strictly positive natural numbers x1xn, prints their least common multiple greater than zero.

Input

Input consists of several cases. Each case begins with a number n ≥ 1, followed by x1xn. A special case with n = 0 marks the end of input.

Output

For every case, print in a line the least common multiple greater than zero of x1xn. For the given cases, this number will always be between 1 and 109.

Public test cases
  • Input

    3  14 4 5
    1  7
    2  18 18
    2  2000000 3000000
    0
    

    Output

    140
    7
    18
    6000000
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++ Java Python
    User solutions
    C C++ Java Python