TITLE: Integers n for which n divides $a^n-b^n$
QUESTION [5 upvotes]: Hello guys!
Firstly, I'd like to start with a problem: Find all natural numbers n, for which n divides (10^n)-1. Then, I wanna generalize the statement as: Is it possible to find all solutions to the the statement: n divides (a^n)-1, where g.c.d(a,n)=1? Is there any method or algorithm at least, in this case?

REPLY [4 votes]: I would just add a short sentence to the above answer. Since you are only interested in the case when $b=1$ there is a very simple elementary characterization: $n|a^n-1$ if and only if $\mathrm{ord}_n(a)|n$. That also explains the comment above that $3^m|10^{3^m}-1$.
Unfortunately I think it also means that there is no good `formula' for the answer to your problem.