GCD And LCM Of More Than Two Numbers

We know from  and  how to calculate the GCD and LCM of two numbers. How about GCD and LCM of more than two numbers?
Let us do a quick recap of GCD of two numbers. For two numbers $A$ and $B$, it is the largest integer that divides both $A$ and $B$, without leaving any remainder.
The same definition also holds true for $3$ or more numbers. The GCD of $3$ numbers $A$, $B$ and $C$ is the largest integer that divides $A$, $B$ and $C$ without leaving a remainder. Let us try to understand this better by taking a simple example.
We will find out the GCD of $3$ numbers let us say $20$, $30$ and $45$. We calculate the GCD of any two numbers, let's say the first two.
Let us try to find the GCD by factorisation:
$20 = 2 \times 2 \times 5$
$30 = 2 \times 3 \times 5$
$45 = 3 \times 3 \times 5$

If we try to take the common factors of all the given $3$ numbers, we can see that $5$ is the only common factor that occurs in all $3$ numbers.
The GCD of $20$, $30$ and $45$ is $5$.

What if we had to find the GCD of $3$ or more very large numbers. As we learnt during Euclid's Method, that factoring any large number is very difficult.
Let us say you were to find the GCD of $5074$, $5762$, $9417$. Factoring these $3$ numbers will take a lot of time and calculations.

Let us look at our previous example and try to understand something more about GCD. Let us take a look at the first two number and the common factor is $2 \times 5 = 10$. Since the common factor of the first two numbers is $2$ and $5$, the common factors between the three numbers cannot be anything other that $2$ and $5$, because those factor will not be common in the first two numbers. So if we take the GCD of $10$ and $45$ we will be able to find the GCD of the given three numbers.

-----------book page break-----------
So, to find the GCD of $3$ or more numbers we can arrange the given numbers in any order, and find the GCD of the first two numbers, then keep finding the GCD of the next number with the previous GCD.
Coming back to the second example with $5074$, $5762$ and $9417$, we will find out the GCD of the first two numbers using Euclid's method and then find the GCD of the result and the $3^{rd}$ number.
Using the Euclid's method, we can find out the GCD of the first two numbers as $86$.
Using the same method we can find out the GCD of $86$ and $9417$, which is $43$.

So, the GCD of $5074$, $5762$ and $9417$ is $43$.

Now let us look at how we can find out the LCM of $3$ or more numbers.
Let us start with our first example of small numbers and find the LCM by factoring.
$20 = 2 \times 2 \times 5$
$30 = 2 \times 3 \times 5$
$45 = 3 \times 3 \times 5$

So, our LCM is $2 \times 2 \times 3 \times 3 \times 5 = 180$

But this method will not be very useful for larger numbers. As with our GCD, we can find out the LCM of $3$ or more numbers by finding the LCM of the first two numbers, and then for each remaining number we can find the LCM of the next number and the previous LCM.
Before we try this with larger numbers, we need to recollect a property of LCM and GCD, which is for any two given numbers $A$ and $B$,
$LCM \times GCD = A \times B$
so:
$LCM = \dfrac{A \times B}{GCD}$
We will need to use this to find the LCM of two large numbers.

-----------book page break-----------
We will use this method to find the LCM of $182$, $234$ and $299$.
Using Euclid's method the GCD of $182$ and $234$ is $26$.

$\texttip{\therefore}{therefore} LCM = \dfrac{182 \times 234}{26}$
cancelling out $26$ with $182$ we get
$LCM = \dfrac{7 \times 234}{1}$
$LCM = 1638$

Now, we need to find out the LCM of $1638$ and $299$.
Again, using Euclid's method the GCD of $1688$ and $299$ is $13$.
$\texttip{\therefore}{therefore} LCM = \dfrac{1688 \times 299}{13}$
cancelling out $299$ and $13$, we get
$LCM = \dfrac{1688 \times 23}{1}$

$ = 38824$

Quick recap of what we learned today:

Given two numbers $A$ and $B$,
$A \times B = LCM \times GCD$

GCD of 3 or more numbers:
Calculate the GCD of the first two numbers, and thereafter calculate the GCD of each additional number and the previous GCD.

-----------book page break-----------
LCM of 3 or more numbers:
Calculate the LCM of the first two numbers, and thereafter calculate the LCM of each additional number and the previous LCM.

If you are calculating the GCD or LCM of more than two numbers using the factorization method, then do not calculate the actual product at each step. Leave the intermediate values as products of their factors only. This will help you avoid a lot of extra calculations.