TITLE: When does $n$ divide $2^n+1$?
QUESTION [10 upvotes]: For which $n$ does $n\mid2^n+1$ ?

My hypothesis is that the only solution is $n=3^k$, for some positive integer $k$.

REPLY [2 votes]: More generally:

If $n\mid 2^{n}+1$ and $d\mid 2^n+1$ then $nd\mid 2^{nd}+1$.

This is because $n$ and $d$ are odd, so if $2^{n}\equiv -1\pmod d$ then $(-2)^n\equiv 1\pmod d$ and $$\begin{align}\frac{2^{nd}+1}{2^n+1}&=\frac{1-((-2)^n)^d}{1-(-2)^n} \\
&= 1+(-2)^n+(-2)^{2n}-\cdots +(-2)^{n(d-1)}\\
&\equiv 1+1+1+\cdots 1 \\&= d\equiv 0\pmod{d}.\end{align}$$
So $(2^n+1)d\mid 2^{nd}+1$ and hence $nd\mid 2^{nd}+1$.
So we can say a solution $n$ is absolutely primitive if, for each prime $p\mid n$,  $2^{n/p}+1$ is not divisible by $\mathrm{lcm}(n/p,p).$
For example, $171=3^2\cdot 19$ is not absolutely primitive because $\mathrm{lcm}(171/19,19)=171\mid 2^{171/19}+1$. And $3$ is not primitive since $\mathrm{lcm}(3/3,3)=3\mid 2^{3/3}+1$.
Indeed, I wonder if there are any absolutely primitive $n$ other than $1$.
If prime $p\mid n$ and $p\mid 2^n+1$ then $2^{n}=( 2^{n/p})^p\equiv 2^{n/p}\pmod p$ and hence if $n$ is absolutely primitive, then $\frac{n}{p}$ can't be a divisor of $2^{n/p}+1$ for any prime divisor $p$ of $n$.
Now given two distinct prime factors $p,q$ of $n$, if $q^k\mid 2^n+1$ and $q^k\not \mid 2^{n/p}+1$ then we must have $q\mid \sum_{i=0}^{p-1} (-2)^{ni/p}$. But if $q\mid 2^{n/p}+1$, we'd have $(-2)^{n/p}\equiv 1\pmod{q}$ and thus $q\mid p$, which is not possible.
This means that, if $n$ is absolutely primitive, then for each prime $p\mid n$ there must be another prime $q\mid n$ such that $q\not\mid 2^{n/p}+1$ and $q\mid 2^{n}+1$.
But if $2^{n/p}+1$ is not divisible by $q$ and $2^{n}+1$ is divisible by $p$, then $-1$ must be a non-trivial $p$th power, modulo $q$, and thus $q-1$ must be divisible by $p$. 
So if $p$ is the largest prime factor of $n$, we get that no such $q$ can exist.
Therefore, for any $n$ with $n\mid 2^n+1$ either $n=1$ or the largest prime $p\mid n$ satisfies $\frac{n}{p}\mid 2^{n/p}+1$ and $p\mid 2^{n/p}+1$.