Let $a\ge 2$ be an integer. Show that for positive integers $m,n$, we have $a^n - 1$ divides $a^m - 1$ if and only if $n$ divides $m$.
I am having trouble showing this. I've seen a similar problem on here but it only shows one direction for the proof. I would like to see both directions.
This is what I have so far: Let $m = nq + r$, then $a^m - 1 = a^{nq + r}- 1 = a^{nq}a^r - 1 = a^{nq}a^r - a^r + a^r - 1 = a^r(a^{nq} - 1) + a^r - 1$. Since $0\le r\lt n$, $r = 0$ then $a^m - 1$ = $a^{nq} - 1$ so $a^m$ = $a^{nq}$ . Thus $m = nq$ hence $n\mid m$.
It might help if you think of writing positive integers not in base 10 as we usually do, nor in base 2 or 16 as computers usually do, but in base $a$. Then $a^n-1$ is an $n$-digit number in which every digit is $a-1$, and similarly for $a^m-1$. This makes it quite easy to see what happens when you apply long division to divide $a^m-1$ by $a^n-1$.