Greatest Common Divisor GCD and Least Common Multiple LCM

Write numbers (at least 2 and at most 4, from 1 to 10,000,000) of which you want to find
the Greatest Common Divisor (GCD) and the Least Common Multiple (LCM)



The greatest common divisor and the least common multiple are useful in various mathematical procedures and therefore they are of particular importance.
For their determination we use the prime factorization.
For the greatest common divisor (GCD) you consider only the common factors (primes is bases) with minimum exponent with which they appear in the factorization.
For the least common multiple (LCM) you consider all the factors, common or not, with the maximum exponent with which they appear in the factorization.


