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

(This question is related to this earlier one.)

Let $$\sigma(x)$$ be the sum of divisors of the positive integer $$x$$. The greatest common divisor of the integers $$a$$ and $$b$$ is denoted by $$\gcd(a,b)$$.

Here are my questions:

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

I tried searching for examples and counterexamples via Sage Cell Server, it gave me these outputs for the following GP scripts:

for(x=1, 100, if(gcd(x,sigma(x^2))==gcd(x^2,sigma(x^2)),print(x)))


All positive integers from $$1$$ to $$100$$ (except for the integer $$99$$) satisfy $$\gcd(m,\sigma(m^2))=\gcd(m^2,\sigma(m^2))$$.

for(x=1, 1000, if(gcd(x,sigma(x^2))<>gcd(x^2,sigma(x^2)),print(x)))


The following integers in the range $$1 \leq m \leq 1000$$ DO NOT satisfy $$\gcd(m,\sigma(m^2))=\gcd(m^2,\sigma(m^2))$$. $$99 = {3^2}\cdot{11}$$ $$154 = 2\cdot 7\cdot 11$$ $$198 = 2\cdot{3^2}\cdot{11}$$ $$273 = 3\cdot 7\cdot 13$$ $$322 = 2\cdot 7\cdot 23$$ $$396 = {2^2}\cdot{3^2}\cdot{11}$$ $$399 = 3\cdot 7\cdot 19$$ $$462 = 2\cdot 3\cdot 7\cdot 11$$ $$469 = 7\cdot 67$$ $$495 = {3^2}\cdot 5\cdot 11$$ $$518 = 2\cdot 7\cdot 37$$ $$546 = 2\cdot 3\cdot 7\cdot 13$$ $$553 = 7\cdot 79$$ $$620 = {2^2}\cdot 5\cdot 31$$ $$651 = 3\cdot 7\cdot 31$$ $$693 = {3^2}\cdot 7\cdot 11$$ $$741 = 3\cdot 13\cdot 19$$ $$742 = 2\cdot 7\cdot 53$$ $$770 = 2\cdot 5\cdot 7\cdot 11$$ $$777 = 3\cdot 7\cdot 37$$ $$792 = {2^3}\cdot{3^2}\cdot 11$$ $$798 = 2\cdot 3\cdot 7\cdot 19$$ $$903 = 3\cdot 7\cdot 43$$ $$938 = 2\cdot 7\cdot 67$$ $$966 = 2\cdot 3\cdot 7\cdot 23$$ $$990 = 2\cdot{3^2}\cdot 5\cdot 11$$

MY ATTEMPT

I know that primes $$m_1 := p$$ and prime powers $$m_2 := q^k$$ satisfy the equation, since then we have $$\gcd(m_1, \sigma({m_1}^2)) = \gcd(p, \sigma(p^2)) = 1 = \gcd(p^2, \sigma(p^2)) = \gcd({m_1}^2, \sigma({m_1}^2)),$$ and $$\gcd(m_2, \sigma({m_2}^2)) = \gcd(q^k, \sigma(q^{2k})) = 1 = \gcd(q^{2k}, \sigma(q^{2k})) = \gcd({m_2}^2, \sigma({m_2}^2)).$$

This shows that there are infinitely many solutions to the equation $$\gcd(m, \sigma(m^2)) = \gcd(m^2, \sigma(m^2)).$$

Follow-Up Questions

What can be said about solutions to $$\gcd(m, \sigma(m^2)) = \gcd(m^2, \sigma(m^2))$$ for which the number of distinct prime factors $$\omega(m)$$ satisfies

(a) $$\omega(m)=2?$$

(b) $$\omega(m)=3?$$

• For $(a)$ we could consider first integers $m=pq$, for distinct primes $p$ and $q$. The exceptions are $(p,q)=(7,67),(7,79),\ldots$. This post seems related. Commented Apr 16, 2020 at 10:13
• Thank you for your time and attention, @DietrichBurde. I did notice that too. I do wonder why most exceptions in the range $[1, 1000]$ appear to be divisible by $7$. I have not yet checked, but I will try to extend my search further. Commented Apr 16, 2020 at 10:19
• This question is actually related to this post. Commented Apr 16, 2020 at 10:51
• @JoseArnaldoBebita-Dris Are you content with a calculation with a large search-limit, lets say, $\ m=10^8\$ ? Commented Apr 16, 2020 at 13:52
• @Peter Yes I would be interested to know whether most exceptions to the equation in that range are divisible by $7$. Commented Apr 16, 2020 at 14:03

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\$$.