Does a negative input change the answer?
No. Divisibility uses the absolute values, so the sign does not affect the GCD or LCM.
Find the greatest common divisor and least common multiple of two integers.
Adjust the values below to get a clear estimate.
Repeated remainders find the GCD efficiently. For non-zero values, the LCM is the absolute product divided by the GCD; zero is handled directly.
gcd(a,b) = gcd(b, a mod b); lcm(a,b) = |ab| / gcd(a,b)Inputs: firstNumber: 48 · secondNumber: 18
Illustrative result: GCD 6 · LCM 144
Six is the largest shared divisor; 48 × 18 divided by 6 gives the least common multiple 144.
No. Divisibility uses the absolute values, so the sign does not affect the GCD or LCM.
By this calculator’s convention, it is zero because zero is divisible by every non-zero integer multiple relationship used here.