For two integers a and b, lcm(a,b) is the least natural number which is a multiple of both a and b. If you calculate the greatest common divisor of a and b, then to get the lcm you simply take ab/gcd(a,b).