Open In App

How to find GCD of more than 2 numbers

Last Updated : 23 Jul, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

Greatest Common Divisor (GCD) of two or more integers is the largest positive integer that divides each of the integers without leaving a remainder. It can also be referred to as the Greatest Common Factor (GCF) or Highest Common Factor (HCF).

Example, the GCD of 12 and 18 is 6, as 6 is the largest number that divides both 12 and 18 evenly.

Finding the GCD of two numbers is quite simple; you can use the Euclidean algorithm or prime factorization. However, when finding the GCD of three or more numbers, you first calculate the GCD of the first two numbers and then use that result with the next number.

Finding the GCD of more than 2 numbers

To find the GCD of more than two numbers, you can use the following methods:

  • Prime Factorization Method
  • Long Division Method ( Euclid’s Division Algorithm)

Method 1: Prime Factorization Method to Find GCD

The prime factorization method means dividing each number into its prime factors, which are the prime numbers that multiply together to make the original number. To find the GCD, you take the product of the smallest powers of all the prime factors that the numbers have in common.

Note: This method works only for positive integers (natural numbers).

Example 1: Find the GCD of 36, 48, and 60.

Solution:

To find the GCD of 36, 48, and 60, we need to find the:

  • Prime factors of 36 = 22 × 32
  • Prime factors of 48 = 24 × 31
  • Prime factors of 60 = 22 × 31 × 51

The common prime factors are 2 and 3, and their smallest powers are 22 and 31.
So, the GCD of 36, 48, and 60 is:

GCD (36, 48, 60) = 22 × 31 = 12

Example 2: Find the GCD of 18, 30, 42, and 54.

Solution:

To find the GCD of 18, 30, 42, and 54, we need to find the:

  • Prime factors of 18 = 21 × 32
  • Prime factors of 30 = 21 × 31 × 51
  • Prime factors of 42 = 21 × 31 × 71
  • Prime factors of 54 = 21 × 33

The common prime factors are 2 and 3, and their smallest powers are 21 and 31.

So, the GCD of 18, 30, 42, and 54 is:

GCD (18, 30, 42, 54) = 21 × 31 = 6

Note: Similarly, you can find the GCD for more numbers in the same way by looking at the prime factors of each number and taking the product of the smallest powers of the common prime factors.

Method 2: Long Division Method ( Euclid’s Division Algorithm) to Find GCD

This method uses Euclid's Division Algorithm that works for positive integers and follows these steps:

Step 1: Apply Euclid’s division lemma to two numbers a and b, where a > b. The division lemma gives two numbers q (quotient) and r (remainder), such that: a = bq + r where 0 ≤ r < b

Step 2: If the remainder r = 0, then b is the GCD of a and b. If r ≠ 0, apply the division lemma again to b and r.

Step 3: Continue the process until the remainder is zero.

Step 4: When the remainder is zero, the divisor at that stage is the GCD of the given numbers.

This algorithm is efficient and works well for large numbers.

Example 1: Find the GCD of 60, 48, and 36.

Solution:

Step 1: Find GCD of 60 and 48

  • Divide 60 by 48 : 60 = 48 × 1 + 12 (Remainder 12)
  • Divide 48 by 12: 48 = 12 × 4 + 0 (Remainder 0)

The GCD of 60 and 48 is 12.

Step 2: Find GCD of 12 and 36

  • Divide 36 by 12: 36 = 12 × 3 + 0 (Remainder 0)

The GCD of 12 and 36 is 12.

Conclusion: Therefore, the GCD of 60, 48, and 36 is 12.

Example 2: Find the GCD of 72, 120, 48, and 36.

Solution:

Step 1: Find GCD of 72 and 120

  • Divide 120 by 72: 120 = 72 × 1 + 48 (Remainder 48)
  • Divide 72 by 48: 72 = 48 × 1 + 24 (Remainder 24)
  • Divide 48 by 24: 48 = 24 × 2 + 0 (Remainder 0)

The GCD of 72 and 120 is 24.

Step 2: Find GCD of 24 and 48

  • Divide 48 by 24: 48 = 24 × 2 + 0 (Remainder 0)

The GCD of 24 and 48 is 24.

Step 3: Find GCD of 24 and 36

  • Divide 36 by 24: 36 = 24 × 1 + 12 (Remainder 12)
  • Divide 24 by 12: 24 = 12 × 2 + 0 (Remainder 0)

The GCD of 24 and 36 is 12.

Conclusion: Therefore, the GCD of 72, 120, 48, and 36 is 12.

Next Article - Relation between GCD and LCM


Similar Reads