ScienForge

GCF and LCM calculator

Find the greatest common factor and least common multiple of up to four whole numbers, with the prime factorisation of each.

Greatest common factor
12
Least common multiple720
Coprime?No
Factors of 482^4 × 3
Factors of 1802^2 × 3^2 × 5
Check: GCF × LCM8640 = 48 × 180

Whole positive numbers only.

The greatest common factor is the largest number that divides every input exactly. The least common multiple is the smallest number every input divides into. They are opposite ends of the same idea, and both fall straight out of prime factorisation.

Through prime factors

Factor each number into primes. For the GCF take the lowest power of each shared prime; for the LCM take the highest power of every prime that appears.

48 = 2⁴ × 3 180 = 2² × 3² × 5 GCF = 2² × 3 = 12 LCM = 2⁴ × 3² × 5 = 720

The Euclidean algorithm

Factorising is slow for large numbers. Euclid’s method is far faster: divide the larger by the smaller, keep the remainder, repeat until the remainder is zero. The last non-zero remainder is the GCF.

180 ÷ 48 = 3 remainder 36 48 ÷ 36 = 1 remainder 12 36 ÷ 12 = 3 remainder 0  → GCF = 12

This is one of the oldest algorithms still in everyday use, dating to around 300 BC, and it remains the method computers actually use. It is fast enough to handle numbers with hundreds of digits.

The identity linking them

GCF(a, b) × LCM(a, b) = a × b

This holds for exactly two numbers and is the usual way to get the LCM: find the GCF by Euclid, then divide the product by it. It fails for three or more, where you must chain the operation pairwise instead.

Where they get used

  • Simplifying fractions. Divide top and bottom by their GCF to reach lowest terms in one step.
  • Adding fractions. The LCM of the denominators is the least common denominator, which keeps the arithmetic as small as possible.
  • Repeating events. Two buses leaving every 12 and 18 minutes coincide every LCM(12,18) = 36 minutes. Gear teeth, traffic lights and scheduling problems all reduce to this.
  • Cryptography. Numbers whose GCF is 1 are coprime, and coprimality is central to RSA and to modular arithmetic generally.

Related calculators