MXMLCM gives wrong answer

So I calculated the lcm of the whole array using the inbuilt gcd function and iterated over m to find the lowest value between 1 and m that gives the highest lcm.

Thanks in advance :slight_smile:

LCM overflows range of integer.
Store prime factorization of LCM instead.

can you have a look at this please