So, the max LCM is a * b, and the minimum is b. By making a list of multiples of b, that reduces the length of the list of multiples, thus reducing the amount of numbers to check. This algorithm is pretty fast, but it makes more sense to do (a*b)/gcd(a,b).

As opposed to checking from 2 to the square root, it checks 2, then 3, then 5, ... up to the square root. Before, I created an algorithm which did all of the prime numbers up until the square root, but the number had to be VERY large for that method to be faster than the one above.

Product of a List

Unlike the ones above, this one uses a module functools, and the function reduce. What that function does, is it reduces the entire list into an element by doing a binary operation.

def product(array):
return functools.reduce(lambda x,y: x * y, array)

What this does is brings it together by multiplying the numbers in the list. So the list becomes ((((a*b)*c)*d)*e). Now, the list is reduced to one element.