Let and be two nonzero integers. Then the greatest common divisor (GCD) of and , denoted , is the greatest positive integer such that is a divisor of both and . If both and are zero, the GCD is considered either undefined or .
Let and be two integers. Then the least common multiple (LCM) of and , denoted , is the smallest positive integer such that and are both divisors of . If either or is zero, the LCM is sometimes considered either undefined or .
Definitions
Group Theory
In group theory, the GCD of is defined to be the positive generator of group under addition.
The LCM is defined to be the positive generator of under addition.
Number Theory
In number theory, both GCD and LCM are defined by an appeal to the fundamental theorem of arithmetic. In particular, integers and have unique prime factorizations:
Then
Order Theory
In order theory, the GCD is defined to be the greatest lower bound of the set of positive integers ordered by divisibility. That is, with respect to divisibility.
The LCM is similarly defined to be the least upper bound of the set of positive integers ordered by divisibility. That is, with respect to divisibility.
Monotonicity
Both GCD and LCM are monotonic under divisibility. That is,
For any pair of positive integers and , there exist integers and such that
Euclidean Algorithm
Let . By the division algorithm, there exist integers and such that where . Then .
The Euclidean algorithm (also known as Euclid's algorithm) is a method for computing the GCD of two positive integers using the above identity. It works by repeatedly applying the division algorithm, stopping once the remainder is . For integers , the process looks as follows: