Number Theory
Basic

LCM from GCD

Least common multiple via the greatest common divisor.

Formula

lcm(a,b)=abgcd(a,b)\text{lcm}(a,b) = \frac{|a b|}{\gcd(a,b)}

Variables

a, bIntegers

Example

lcm(12, 18) = 12·18/gcd(12,18) = 216/6 = 36.

Did You Know?

The product of two numbers always equals their GCD times their LCM — a neat, useful identity.