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.

https://www.codechef.com/viewsolution/30842754

Thanks in advance :slight_smile:

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

can you have a look at this please
https://discuss.codechef.com/something-fishy-with-mxmlcm-test-case/59217