Implemented lcm and gcd