Properties of GCD and LCM

For two (positive) integers N and M, the properties of their greatest common divisor gcd and the least common multiple lcm come in pairs; the phenomenon is partly explained by the formula gcd(M, N) × lcm(M, N) = M × N. The basic fact that "P being a factor of Q" and "Q being a multiple of P" are equivalent also contributes to a certain kind of symmetry in properties of gcd and lcm.

(Above, as below, the symbols M, N, P, Q stand for positive integers.)

P|N and P|M ⇒ P|gcd(N, M),
N|P and M|P ⇒ lcm(N, M)|P.

In plain English: every common divisor of N and M, also divides their greatest common divisor; and every common multiple of two integers is divisible by their least common multiple.

N = gcd(N, M) ⇔ N|M
M = lcm(N, M) ⇔ N|M.

In plain English: N divides M if and only if N is the greatest common divisor of the pair; in turn, this is only true if M is the least common multiple of the two.

gcd(P·N, P·M) = P·gcd(N, M)
lcm(P·N, P·M) = P·lcm(N, M).

In plain English: an extra common factor of N and M is a factor of both gcd(N, M) and lcm(N, M). This is easily observed with the interactive tool for computing gcd and lcm.


It is enough to establish this property for prime P. Suppose prime p appears in the factorization of N with the exponent, a ≥ 0, and in M with the exponent b ≥ 0. Then the exponents of p in pN and pM are, respectively, a + 1 and b + 1. For a ≥ b, p is included in the prime factorization of gcd(N, M) with exponent b and in the factorization of lcm(N, M) with the exponent b. In the factorizations of gcd(pN, pM) and lcm(pN, pM), the exponents of p are a + 1 and b + 1, respectively.

If gcd(N1, N2) = 1, then

gcd(N1·N2, M) = gcd(N1, M)·gcd(N2, M)
lcm(N1·N2, M) = lcm(N1, M)·lcm(N2, M)/M.

In plain English: for relatively prime N1 and N2, gcd(N, M) and lcm(N, M)/M are multiplicative functions of the first argument. Observe that the two identities are equivalent. One implies the other via gcd(M, N) × lcm(M, N) = M × N. On the other hand, if proved directly, they imply this identity.

It is important to observe that, for distinct primes p and q, gcd(pa, qb) = 1 while lcm(pa, qb) = paqb, for any exponents a, b ≥ 0. Now then, in particular case where N = paqb,

  gcd(N, M) = gcd(paqb, M) = gcd(pa, M)·gcd(qb, M),
lcm(N, M) = lcm(paqb, M) = lcm(pa, M)·lcm(qb, M),

which shows that much can be done by taking the prime number decomposition and looking at one prime factor at a time.

gcd(gcd(N, M), P) = gcd(N, gcd(M, P))
lcm(lcm(N, M), P) = lcm(N, lcm(M, P)).

This property can be described as the associativity of both gcd and lcm. Associativity shows that the gcd and lcm for more than two numbers could be defined unambiguously in several ways. For example

gcd(M, N, P) = gcd(gcd(M, N),P) = gcd(M, gcd(N, P))
lcm(M, N, P) = lcm(lcm(M, N),P) = lcm(M, lcm(N, P)).

With this definition we state and prove lemma that was instrumental in establishing the generalized Chinese Remainder Theorem.


For integers N1, ..., Nk, k ≥ 2,

lcm(gcd(N1, M), gcd(N2, M), ..., gcd(Nk, M)) = gcd(lcm(N1, ..., Nk), M)
gcd(lcm(N1, M), lcm(N2, M), ..., lcm(Nk, M)) = lcm(gcd(N1, ..., Nk), M).

As with the union and intersection of the sets, gcd and lcm satisfy two distributive laws.


We prove the first identity. Let p be a prime divisor of lcm(gcd(N1, M), gcd(N2, M), ..., gcd(Nk, M)) and α the largest exponent such that pα|lcm(gcd(N1, M), gcd(N2, M), ..., gcd(Nk, M)), pα divides at least one of gcd(Ni, M), i = 1, ..., k. Let it be gcd(N1, M). Thus pα is a common divisor of N1 and M. Since pα|N1 it also divides any multiple of N1, in particular, lcm(N1, ..., Nk). It follows that pα is the common factor of lcm(N1, ..., Nk) and M and, therefore, pα divides gcd(lcm(N1, ..., Nk), M).

Conversely, suppose, for a prime p, pα divides gcd(lcm(N1, ..., Nk), M). It then divides both lcm(N1, ..., Nk) and M. Being a power of a prime, it divides at least one of Ni. Let it be N1. Then pα is a common multiple of N1 and M and, therefore, divides gcd(N1, M) and, consequently, any multiple thereof, lcm(gcd(N1, M), gcd(N2, M), ..., gcd(Nk, M)), in particular.


(The First Moscow Mathematical Olympiad, 1935)

lcm(M, N, P) · gcd(M, N) · gcd(N, P) · gcd(P, M) = NMP · gcd(N, M, P).

Related material

  • Factoring with the Factor Tree
  • GCD and LCM via Factor Tree
  • GCD and LCM by Plain Factorization
  • Common Multiples and the Least Common Multiple
  • GCD(M, N) x LCM(M, N) = M x N
  • Divisibility Criteria
  • Euclid's Algorithm
  • Algorithm for Computing the LCM
  • Factors And Multiples
  • Two Properties of Greatest Common Divisor
  • A Line in a Square Grid
  • Number of Factors of an Integer
  • Extension of Euclid's Game
  • |Contact| |Front page| |Contents| |Arithmetic| |Store|

    Copyright © 1996-2017 Alexander Bogomolny


    Search by google: