<p>How do you calculate the least common multiple of multiple numbers?</p>

<p>So far I've only been able to calculate it between two numbers. But have no idea how to expand it to calculate 3 or more numbers.</p>

<p>So far this is how I did it  </p>

<pre><code>LCM = num1 * num2 /  gcd ( num1 , num2 )
</code></pre>

<p>With gcd is the function to calculate the greatest common divisor for the numbers. Using euclidean algorithm</p>

<p>But I can't figure out how to calculate it for 3 or more numbers.</p>

You can compute the LCM of more than two numbers by iteratively computing the LCM of two numbers, i.e.
```
```
lcm(a,b,c) = lcm(a,lcm(b,c))
```
```