Find all $n>1$ such that $n^{2} \mid 2^{n}+1$.
(P3 IMO 1990)

First, $n$ must be odd, so $2^{n}+1$ must be divisible by 3, which means $n$ must be a multiple of 3. Let's find the 3-adic valuation of $2^{n}+1: v_{3}\left(2^{n}+1\right)=v_{3}(2+1)+v_{3}(n)$. On the other hand, 
$v_{3}\left(n^{2}\right)=2 v_{3}(n)$ and by divisibility we should have $2 v_{3}(n) \leqslant 1+v_{3}(n)$, which imposes $v_{3}(n)=1$ so $n=3 m$ where $m$ is not a multiple of 3.

The problem then becomes equivalent to $m^{2} \mid 8^{m}+1$. Suppose $m \geqslant 2$, and let $p$ be the smallest prime divisor of $m$ (hence odd). It satisfies $8^{2 m} \equiv 1$ modulo $p$, so the order of 8 divides $p-1$ and $2 m$. But $m$ and $p-1$ have no common factors given the properties of $p$, and thus $p \mid 2$, so $p=2$, and $p$ divides $8^{2}-1=63$, so $p=7$ (since $p \neq 3$). However, $2^{n}+1$ is never divisible by 7 according to a study of powers modulo 7, so $m=1$, and we deduce that the only $n$ that works is $n=3$, which is indeed a solution.

## 6 Functional Equations (Benoît)