**Quick Overview:**

## The above the algorithm removes all the factors of remaining numbers which are already included in x.

Explanation:

for eg.

Consider 3 numbers 14, 20, 48

8 = 2 * 2 * 2

14 = 2 * 7

80 = 2 * 2 * 2 * 2 * 5

LCM of (8,14,80) = 2 * 2 * 2 * 2 * 7 * 5

Firstly, x=8

Dividing the remaining numbers with gcd will filter all the factors which are already in x(in this case it is 8).

Thus if the number of a particular factor in x is less than than other numbers, then it will add only the extra factors. And if the number is greater, then the no extra factors need to be multiplied.

Therefore it becomes (2 * 2 * 2) * ( 7 ) *(2 * 5). And since all are multiplication operation, you can take mod at each step.

Hope this helps.