(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?$