Hi Codeforces

I have been trying to solve this problem on SPOJ: https://www.spoj.com/problems/EASYMATH/

My bruteforce solution is ofcourse TLE'd and I came across this solution: https://github.com/Emsawy/Competitive-Programming/blob/master/SPOJ/EASYMATH.cpp

I have difficulty understanding the "go" function. There is a recursive call and it is calculating the LCM of all the divisors? Can someone explain the logic behind this function in simple terms? Is there a formula for this?

Learn inclusion exclusion principle to solve this. It's not hard, and you don't event need the code you are looking into :)