Prove that if $n \mid 10^n-1$ then $3 \mid n$

Let $p$ be the smallest prime such that $p|n$.

(edit: Note that $2|n$ and $5|n$ are impossible, so $p\neq 2$ and $p\neq 5$.)

Let $a>0$ be the smallest integer such that $10^a \equiv 1 \mod p$. Because of $10^n \equiv 1 \mod p$ it can be shown that $a|n$.

Suppose $a=1$, then it follows $p=3$ and we are done.

Since $10^{p-1}\equiv 1\mod p$ we know that $a<p$.

So we have $1<a<p$ and $a|n$, which is a contradiction to $p$ being the smallest prime that divides $n$.