Free Tool · Up to 10 Numbers · Step-by-Step

LCM & GCF Calculator

Find the least common multiple and greatest common factor of any list of numbers, with Euclid's algorithm and prime factorisation shown.

Positive integers only, up to 10 numbers. Negative signs are ignored.

What this LCM and GCF calculator does

This tool computes two quantities for any list of whole numbers. The greatest common factor (GCF, also called HCF or GCD) is the largest number that divides evenly into every entry in the list. The least common multiple (LCM) is the smallest positive number that is a multiple of every entry. Both quantities are fundamental in the Punjab board syllabus: the GCF appears when simplifying fractions and factorising polynomials, and the LCM appears when adding fractions with unlike denominators and in problems involving events that recur at regular intervals. The calculator accepts up to ten numbers, uses Euclid's algorithm for the GCF, and prime factorisation for the LCM, showing the working step by step.

Formulas and methods

GCF via Euclid's algorithm (two numbers)
Repeat: replace (a, b) with (b, a mod b) until b = 0. The remaining a is GCF(a, b).
GCF for more than two numbers
GCF(a, b, c, …) = GCF(GCF(a, b), c, …)
LCM from GCF (two positive numbers)
LCM(a, b) = (a × b) / GCF(a, b)
LCM via prime factorisation
Write each number as a product of primes. LCM = product of the highest power of each prime that appears.
GCF = product of the lowest power of each common prime.
GCF-LCM identity
For two positive integers a and b: GCF(a, b) × LCM(a, b) = a × b.

Variable definitions

  • a, b, c, … — the numbers in your list.
  • a mod b — the remainder when a is divided by b.
  • GCF — greatest common factor, also called HCF (highest common factor) or GCD (greatest common divisor).
  • LCM — least common multiple.

Worked examples

Example 1: GCF of 48 and 18

  1. Euclid step 1: 48 mod 18 = 12.
  2. Euclid step 2: 18 mod 12 = 6.
  3. Euclid step 3: 12 mod 6 = 0. Remainder is zero, so stop.
  4. The last non-zero divisor is 6. So GCF(48, 18) = 6.

Example 2: LCM of 12 and 18

  1. Prime factorisation: 12 = 2² × 3, 18 = 2 × 3².
  2. Take the highest power of each prime: 2² and 3².
  3. Multiply: 4 × 9 = 36. So LCM(12, 18) = 36.

Example 3: GCF and LCM of 24 and 36 using the identity

  1. GCF(24, 36) via Euclid: 36 mod 24 = 12, 24 mod 12 = 0, so GCF = 12.
  2. LCM using identity: LCM = (24 × 36) ÷ 12 = 864 ÷ 12 = 72.
  3. Check by primes: 24 = 2³ × 3, 36 = 2² × 3². LCM = 2³ × 3² = 8 × 9 = 72. ✓

Example 4: GCF and LCM of three numbers 8, 12, 20

  1. GCF step 1: GCF(8, 12) = 4.
  2. GCF step 2: GCF(4, 20) = 4. So overall GCF = 4.
  3. LCM step 1: LCM(8, 12) = (8 × 12) ÷ 4 = 24.
  4. LCM step 2: LCM(24, 20) = (24 × 20) ÷ GCF(24, 20) = 480 ÷ 4 = 120.

Example 5: The recurring-events problem — bells ringing together

  1. Two bells ring every 12 minutes and every 18 minutes. When do they next ring together?
  2. Find LCM(12, 18) = 36.
  3. They ring together every 36 minutes.
  4. This is the classic classroom application of LCM — periodic events meeting again.

Why LCM and GCF matter in Class 9 & 10

Both quantities appear in practical and theoretical problems across the Punjab board syllabus:

  • Adding fractions — you need the LCM of the denominators to find a common denominator.
  • Simplifying fractions — dividing the numerator and denominator by their GCF reduces to lowest terms.
  • Factorising polynomials — finding the GCF of algebraic terms is the first step in factoring.
  • Real-world scheduling — buses departing at different intervals, bells ringing, gears meshing — all reduce to LCM.
  • Tiling and packaging problems — cutting tiles or packaging items into equal groups uses the GCF.

Common mistakes to avoid

  • Confusing GCF with LCM. GCF is always less than or equal to the smallest number. LCM is always greater than or equal to the largest number. If your GCF is bigger than any input, you've computed an LCM by mistake.
  • Applying the GCF-LCM identity to three or more numbers. GCF(a, b, c) × LCM(a, b, c) is not equal to a × b × c in general. The identity holds only for two numbers. Use the iterative method instead.
  • Forgetting to continue Euclid's algorithm until remainder is zero. Stop when the remainder hits zero, not when it hits one. The answer is the last non-zero divisor.
  • Missing a prime factor. When finding LCM by primes, take the highest power of each prime that appears in any of the numbers. Skipping a prime gives a smaller answer that doesn't work.
  • Using negative numbers. GCF and LCM are defined for positive integers. This calculator takes absolute values, but in exam problems, always work with positive numbers.
  • Assuming GCF of 1 means the numbers are prime. Two numbers with GCF 1 are coprime, but neither has to be prime. For example, GCF(8, 9) = 1 even though both are composite.

FAQ

What is the difference between GCF and LCM?

The greatest common factor (GCF, also called HCF or GCD) is the largest number that divides evenly into all the numbers. The least common multiple (LCM) is the smallest number that all the numbers divide evenly into. For 12 and 18, GCF is 6 and LCM is 36.

How are GCF and LCM related?

For two positive integers a and b, GCF(a, b) times LCM(a, b) equals a times b. For 12 and 18: GCF = 6, LCM = 36, and 6 times 36 = 216 = 12 times 18. This relationship does not extend directly to three or more numbers.

How do I find the GCF using Euclid's algorithm?

Repeatedly replace the larger number with the remainder when the larger is divided by the smaller. When the remainder is zero, the last non-zero divisor is the GCF. For 48 and 18: 48 mod 18 = 12, 18 mod 12 = 6, 12 mod 6 = 0, so GCF = 6.

How do I find the LCM using prime factorisation?

Write each number as a product of primes, then take the highest power of each prime that appears. For 12 = 2 squared times 3 and 18 = 2 times 3 squared, the LCM is 2 squared times 3 squared = 4 times 9 = 36.

Can LCM and GCF be found for more than two numbers?

Yes. For GCF, apply Euclid's algorithm iteratively: GCF(a, b, c) = GCF(GCF(a, b), c). For LCM, use LCM(a, b, c) = LCM(LCM(a, b), c). This calculator accepts up to ten numbers.

What if all the numbers are zero?

GCF of any set that includes zero is defined as the GCF of the non-zero numbers. If all numbers are zero, both GCF and LCM are undefined. LCM of a set that includes zero is zero.

Related tools

Related Hira Academy resources

LCM and GCF underpin the fractions and factorisation chapters of the BISE Punjab mathematics syllabus. Revise the theory with our free Class 9 notes and Class 10 notes.

↑