Find all positive integers $n$ for some given condition. Find all positive integers $n>1$ such that $n^2$ divides $2^n+1$
I found that $n$ is of the form $6k+3$.  
 A: The only answer is $n=3$
(1) Since $n$ divides $2^n + 1$, $n$ is odd.  Let $p$ be the smallest prime divisor of $n$
(2)  Let $a$ be the smallest positive integer such that $2^a \equiv -1 \pmod p$.  $a$ must exist since $2^n \equiv -1 \pmod p$
(3)  Let $b$ be the smallest positive integer such that $2^b \equiv 1 \pmod p$.  $b$ must exist and $b < p$ since $2^{p-1} \equiv 1 \pmod p$
(4)  There exists $q,r$ such that $n = qb+r$ and $0 \le r < b$ so that $-1 \equiv 2^n \equiv (2^b)^q2^r \equiv 2^r \pmod p$ and $a \le r < b$ and $r > 0$
(5)  There exists $h,k$ such that $n = ha+k$ and $0 \le k < a$ so that $-1 \equiv 2^n \equiv (2^a)^h2^k \equiv (-1)^h2^k \pmod p$
(6)  $k=0$ since if $k > 0$ then $h$ cannot be even since then $2^k \equiv -1 \pmod p$ and $k < a$ and $h$ cannot be odd since $2^k \equiv 1 \pmod p$ and $k < a \le r < b$
(7) Since $k=0$, $a | n$.  Since $a < p$, $a=1$ but if $2^1 \equiv -1 \pmod p$, $p=3$ 
(8)  From the article cited by Shivang, we have:

Let $v_p(x)$ be the greatest power in which prime $p$ divides $x$. 
Theorem 2: (Second form of LTE) Let $x,y$ be two integers, $n$ be an odd positive 
  integer and $p$ an odd prime such that $p|(x+y)$ and none of $x$ and $y$ is divisible by 
  $p$, we have:
$$v_p(x^n + y^n) = v_p(x+y) + v_p(n)$$

(9)  Let $x=2$, $y=1$
(10)  By Theorem 2: $v_3(2^n + 1) = v_3(2^n + 1^n) = v_3(2+1) + v_3(n) = 1 + v_3(n)$
(11)  So, there exists $w$ with odd $r,s$ such that $3^wr = n$ and $3 \nmid r$ and $3^{w+1}s = 2^n + 1$ and $3 \nmid s$.  Since $n^2 | 2^n+1$, it follows that $3^{2w}r^2 |\, (3^{w+1}s)$ but this is only possible if $2w = w+1$ so that $w=1$.
(12) So, we have $n=3r$.  Asume $r > 1$ Let $p$ be the least prime that divides $r$. Since $r | (2^n+1)(2^n - 1) = 2^{2n} - 1$, so $2^{2n} \equiv 1 \pmod p$ and using Fermat's Little Theorem gives us $2^{p-1} \equiv 1 \pmod p$.  Therefore $2^{\gcd(2n,p-1)}\equiv 1 \pmod p$.  Since $p$ is the least prime, $(p-1) \nmid n$, $\gcd(2n,p-1)=2$
(13)  But if $2^2\equiv 1\pmod p$, then $p=3$ which is impossible since $3 \nmid r$ so $r=1$.
(14)  $3^2s = 2^3 + 1$ is only true if $s=1$.  So, the only solution is $n=3$. 
