GCF and LCM Calculator
Greatest common factor, least common multiple, and the factorisations behind them.
What they are
The greatest common factor (GCF, also HCF) is the largest number that divides every value exactly. The least common multiple (LCM) is the smallest number that every value divides into exactly. One looks downward at shared factors, the other upward at shared multiples.
Finding them by prime factorisation
Break each number into primes. For the GCF, take each prime that appears in every number, at its lowest power. For the LCM, take each prime that appears in any number, at its highest power.
GCF = 2 × 3 = 6 LCM = 2³ × 3² = 72
The Euclidean algorithm
For two numbers there is a faster route that needs no factorising: divide the larger by the smaller, replace the pair with (smaller, remainder), and repeat until the remainder is zero. The last non-zero remainder is the GCF. For 18 and 12: 18 = 1×12 + 6, then 12 = 2×6 + 0, so the GCF is 6. This is what the calculator uses, and it stays fast on numbers far too large to factorise.
The relationship for two numbers
So 6 × 36 = 12 × 18. Useful as a check, but note it holds only for two numbers — it does not extend to three or more.
Where they get used
The GCF reduces fractions to lowest terms and factors expressions. The LCM finds a common denominator for adding fractions, and answers 'when do two repeating events coincide' problems.