Home

lcm

The least common multiple (LCM) of a set of integers is the smallest positive integer that is a multiple of each number in the set. For two integers a and b, the LCM is the least positive number divisible by both a and b. The operation is commutative and associative, so the LCM of a set can be computed by repeatedly taking the LCM of pairs.

A common way to compute lcm(a,b) is via the greatest common divisor: lcm(a,b) = |a × b| /

Several properties are noteworthy. The LCM is related to the greatest common divisor via gcd(a,b) × lcm(a,b)

gcd(a,b)
for
nonzero
a
and
b.
Another
method
uses
prime
factorization:
if
a
=
∏
p_i^{α_i}
and
b
=
∏
p_i^{β_i},
then
lcm(a,b)
=
∏
p_i^{max(α_i,
β_i)}.
For
more
than
two
numbers,
lcm(a1,
a2,
...,
an)
can
be
found
by
iteratively
taking
pairwise
LCMs,
or
by
taking
the
product
of
primes
raised
to
the
maximum
exponent
that
appears
in
any
factorization.
=
|a
×
b|
for
integers
a
and
b.
LCMs
are
used
to
find
common
denominators
when
adding
or
comparing
fractions
and
to
synchronize
cycles
or
events
that
must
coincide.
Special
cases
include
lcm(0,
n)
=
0
for
n
≠
0
by
common
convention,
while
lcm(0,0)
is
undefined
or
defined
as
0
in
some
contexts.