When does $\gcd(m,\sigma(m^2))$ equal $\gcd(m^2,\sigma(m^2))$? What are the exceptions?

Solution 1:

The following PARI/GP-routines efficiently determine the numbers of solutions and the ratio of numbers divisible by $\ 7\ $. You can easily adjust the range.

Exactly two prime factors

? q=0;r=0;for(m=1,10^7,if(omega(m)==2,if(gcd(m,sigma(m^2))<>gcd(m^2,sigma(m^2)),if(Mod(m,7)==0,q=q+1);if(Mod(m,7)<>0,r=r+1))));print(q,"  ",r,"   ",q+r,"   ",q/(q+r)*1.0)
5301  1216   6517   0.81341107871720116618075801749271137026
? 

Over 80% of the exceptions are divisible by $\ 7\ $.

Exactly three prime factors

? q=0;r=0;for(m=1,10^7,if(omega(m)==3,if(gcd(m,sigma(m^2))<>gcd(m^2,sigma(m^2)),if(Mod(m,7)==0,q=q+1);if(Mod(m,7)<>0,r=r+1))));print(q,"  ",r,"   ",q+r,"   ",q/(q+r)*1.0)
77535  103019   180554   0.42942831507471448984791253586184742515
? 

Here, the situation is quite different. Only about 43% of the exceptions are divisible by $\ 7\ $.