Find all positive integers $n$ such that $\phi(n)+\sigma(n)=2n$.

I'm asked to find all integers $n$ such that $\phi(n)+\sigma(n)=2n.$ I know that when $n$ is a prime, $\phi(n)+\sigma(n)=(n-1)+(n+1)=2n.$ My guess is that $n$ can be primes only, and I want to derive a contradiction when $n$ is a composite number. But I can only show that when $n=pq$ ($p$, $q$ distinct primes), $\phi(n)+\sigma(n)=2pq+2=2n+2.$ How do I generalize from here?


Start with the definitions of $\sigma$ and $\phi$:

$ \sigma(n) = \sum_{d \vert n}{d}$

$ \phi(n) = \prod_i{(p_i - 1) \cdot p_i^{e_i-1}} $

Expand the product and rewrite as:

$ \phi(n) = \sum_{d \vert n}{a_d \cdot d}$

with coefficients $a_d \in \{-1,0,1\}$. So now we have

$ \sigma(n) + \phi(n) = \sum_{d \vert n}{(a_d + 1) \cdot d} $

and since $a_n = 1$:

$ \sigma(n) + \phi(n) = 2 \cdot n + \sum_{d \vert n, d < n}{(a_d + 1) \cdot d}$

Now $\sigma(n) + \phi(n) = 2 \cdot n$ if and only if $a_d = -1$ for all proper divisors $d$. This is only true for prime $n$, and $n=1$. Otherwise some positive terms remain.