$\sigma(n) \equiv 1 \space \pmod{n}$ if and only if $n$ is prime For $n&gt;1$, let $\sigma(n)$ denote the sum of all positive integers that evenly divide $n$. Then $\sigma(n) ≡ 1 \space(mod\space n)$ if and only if $n$ is prime.

I've been trying to prove this for a long time, but i can't figure it out.

I found a theorem that might be helpful:

$\sigma(n) = n + k$  has finitely many solutions for $k &gt; 1$ (more specifically, this equation has no solutions for $n≥k^2$).

proof:

let  $n≥k^2&gt;1,\space \sigma(n) = n + k$. Note that $n$ must be a composite number (otherwise $k=1$). Therefore, $n$ has a divisor $d≥\sqrt n$. From $\sigma(n)$'s definition:
$\sigma(n) ≥ n+d+1≥n+\sqrt n + 1 ≥ n + k + 1 &gt; n + k$

If anyone can generalize this to $\sigma(n)=qn+k$, or something like that, it might help.
This is a hard problem.

If you can prove your conjecture, then it will imply immediately that there are no quasi-perfect numbers. The existence of quasi-perfect numbers is a long-open problem.
If $p$ is prime then the only number that divide $p$ are $1$ and $p$ so $\sigma (p) = 1 + p \equiv 1 \mod p$.

So that's one direction.

Let $\sigma(n)=1$ .

If $\sigma(n) \equiv 1 \mod n$ and if $k|n$ then $\sigma (n) \equiv 1 \mod \frac nk$ (because if $n|\sigma(n) -1$ and $\frac nk|n$ then $\frac nk|\sigma(n) -1$.)

Now $\sigma(n) = $ sum of all factors that are multiples of $\frac nk$ plus all the multiples that are not multiples of  $\frac nk $.

All the multiples that are not multiples of  $\frac nk =\sigma(\frac nk)$.

So $\sigma(n) \equiv \sigma(\frac nk) \mod \frac nk$.

So $\sigma(\frac nk)\equiv 1 \mod \frac nk$.

So by induction.

$\sigma(pq) \equiv 1 \mod pq$ where $p\ne q$ but $pq|n$ and $\sigma(p^2) \equiv 1 \mod p^2$ where $p^2|n$.

We can show these are impossible.  $\sigma(p^2) = 1 + p + p^2 \equiv 1+p \mod p^2$ and as $1 &lt; 1+ p &lt; p^2$ that is not equivalent to $1$.

If $pq|n$ and $p\ne q$ wolog assume $p\le 2  &lt; q$ then $\sigma(pq) = 1 + p + q + pq \equiv 1+p + q \mod pq$.  But $1+p + q \le q + q \le pq$.  Equality can only hold if $p = 2$ and $q=3$ and in that case $1+ 2 + 3\equiv 0 \mod 6$.

So... these are contradictions.  It's not possible that $n$ has two or more unequal prime factors, and it is not possible that $n$ have any prime factor to a power higher than $1$ as a factor.

In other words, $n$ must be prime.