Let $q$ be an (odd) prime, and let $\gcd(q,n)=1$.
Denote the classical sum of divisors of the positive integer $x$ by $\sigma(x)=\sigma_1(x)$.
A number $N$ is said to be perfect if $\sigma(N)=2N$.
Here is my question:
If $\gcd(n^2, \sigma(n^2)) = q\sigma(n^2) - 2(q - 1) n^2$, does it follow that $q n^2$ is perfect?
CONTEXT
It is known that if $p^k m^2$ is perfect, where $p$ is an odd prime satisfying $\gcd(p,m)=1$, then we obtain $$i(p):=\dfrac{\sigma(m^2)}{p^k}=\dfrac{2m^2}{\sigma(p^k)}=\dfrac{D(m^2)}{s(p^k)}, \tag{*}$$ where $D(x)=2x-\sigma(x)$ is the deficiency of $x$ and $s(x)=\sigma(x)-x$ is the aliquot sum of $x$.
(Note that $i(p)$ is odd.) We then obtain $$\sigma(m^2) = p^k {i(p)}$$ and $$m^2 = \dfrac{\sigma(p^k)}{2}\cdot{i(p)},$$ so that $$\gcd(m^2, \sigma(m^2)) = i(p)\cdot\gcd\Bigg(p^k, \dfrac{\sigma(p^k)}{2}\Bigg) = i(p).$$
Additionally, we can also rewrite Equation (*) as $$i(p) = \dfrac{\sigma(m^2)}{p^k} = \dfrac{D(m^2)}{s(p^k)} = \dfrac{(p-1)D(m^2)}{p^k - 1} = \dfrac{\sigma(m^2) - (p-1)D(m^2)}{p^k - (p^k - 1)}$$ $$= p\sigma(m^2) - 2(p-1)m^2.$$
Specializing to $k=1$, we obtain the implication $$qn^2 \text{ is perfect with } \gcd(q,n)=1 \implies \gcd(n^2, \sigma(n^2))=q\sigma(n^2) - 2(q-1)n^2.$$
SANITY CHECK
Let $qn^2$ be an even perfect number. Then $q = 2^t - 1$ and $n^2 = 2^{t-1}$, for some prime number $t$.
We compute $$\gcd(n^2, \sigma(n^2)) = \gcd(2^{t-1}, 2^t - 1) = 1$$ and $$q\sigma(n^2) - 2(q - 1)n^2 = (2^t - 1)(2^t - 1) - 2(2^t - 2){2^{t-1}} = 2^{2t} - 2^{t+1} + 1 - 2^{2t} + 2^{t+1} = 1,$$ whence we have equality between $\gcd(n^2, \sigma(n^2))$ and $q\sigma(n^2) - 2(q - 1)n^2$.
(Note that these computations also "work" for the even perfect number $6$, even though it is squarefree.)
PROBLEM
This takes care of one direction. Can you come up with a proof for the other direction?
Alas, this is where I get stuck.
Note that, in order to prove that $qn^2$ is perfect (with $\gcd(q,n)=1$) follows from $$\gcd(n^2,\sigma(n^2))=q\sigma(n^2)-2(q-1)n^2,$$ it suffices to show that $I(q)I(n^2)=2$ where $I(x)=\sigma(x)/x$ is the abundancy index of the positive integer $x$.
But we have the biconditional $$I(q)I(n^2) = 2 \iff \gcd(n^2,\sigma(n^2))=q\sigma(n^2)-2(q-1)n^2=qn^2\Bigg(I(n^2)-\dfrac{2(q-1)}{q}\Bigg) = qn^2 \Bigg(\dfrac{2q}{q+1}-\dfrac{2(q-1)}{q}\Bigg)=qn^2 \Bigg(\dfrac{2}{q(q+1)}\Bigg) = \dfrac{2n^2}{q+1} = \dfrac{\sigma(n^2)}{q} = D(n^2),$$ where the last three ($3$) equations do hold for a perfect number satisfying $I(q)I(n^2)=2$.
HOWEVER, we also have, given an integer $1 \neq k \equiv 1 \pmod 4$ and a prime $p \equiv 1 \pmod 4$ satisfying $\gcd(p,m)=1$, that $$I(p^k)I(m^2)=2 \iff \gcd(m^2,\sigma(m^2))=p\sigma(m^2)-2(p-1)m^2=pm^2\Bigg(I(m^2)-\dfrac{2(p-1)}{p}\Bigg) = pm^2 \Bigg(\dfrac{2}{I(p^k)}-\dfrac{2(p-1)}{p}\Bigg)=pm^2 \Bigg(\dfrac{2}{p\sigma(p^k)}\Bigg)$$ $$= \dfrac{2m^2}{\sigma(p^k)} = \dfrac{\sigma(m^2)}{p^k} = \dfrac{D(m^2)}{s(p^k)},$$ where the last three (3) equations do hold for a perfect number satisfying $I(p^k)I(m^2)=2$.
Hence, we conclude that the condition $$\gcd(n^2,\sigma(n^2))=q\sigma(n^2)-2(q-1)n^2 \tag{1}$$ by itself cannot force $qn^2$ is perfect, where $q$ is an odd prime satisfying $\gcd(q,n)=1$, since Equation (1) is also true for perfect numbers $p^k m^2$ with $1 < k \equiv 1 \pmod 4$, $p$ a prime satisfying $p \equiv 1 \pmod 4$, and $\gcd(p,m)=1$, in the sense that while the condition $$\gcd(m^2,\sigma(m^2))=p\sigma(m^2)-2(p-1)m^2$$ does hold, $pm^2$ is no longer perfect (in fact, it is deficient since it is a proper factor of the perfect number $p^k m^2$, where $k > 1$).