use existing lcm and gcd method