Help in problem realted to mobius function TRENDGCD — Trending GCD at spoj

I have been trying to solve this problem for a while now but made no progress. Can anybody help with TRENDGCD — Trending GCD at spoj.it is related to mobius function. here is link to the problem https://www.spoj.com/problems/TRENDGCD/