I was riffling through some old posts (see the link at the bottom of this post) in which it was given as a fact that if $3^2$ divides $2^n-1$, then $n$ is divisible by $6$.
It was given in the post as a quick fact, so I wonder if there is an easy argument for this, or if my group theory argument below is probably the best way to go. The result isn't obvious to me anyway, but I might be rusty.
My own thoughts so far: Since $\varphi(3^2)=|\{1,2,4,5,7,8\}|=6$ (the Euler totient function), it follows from Euler-Fermat that
$$2^6\equiv 1\pmod{3^2}.$$
The order of (the residue class of) $2$ must divide the order of the multiplicative group $\left(\mathbb{Z}/(3^2\mathbb{Z})\right)^{\times}$, which is $6$ by the above, so at least we know that if $2^n\equiv 1\pmod{3^2}$, then $n\in\{1,2,3,6,12,18,\ldots\}$, and I have checked by hand that $n\not\in\{1,2,3\}$.
This proves it, but I'm unsure if I'm missing something. Surely there must be groups $\left(\mathbb{Z}/n\mathbb{Z}\right)^{\times}$ in which $2$ has an order strictly smaller than $\varphi(n)$.
This is the post I was looking at, and the answer I was reading is Gottfried Helms' - the one that starts with "A modular view".
This can be readily explained without orders or multiplicative groups, just modular arithmetic. There is a much more obvious reason for this. First of all, knowing nothing else, there are only nine possibilities for $2^n \pmod 9$. As it turns out, three values are impossible:
Only six possibilities remain, and if they all occur, they must occur in a regularly repeating pattern.
The powers of $2$ modulo $9$ are $$2, 4, 8, 7, 5, 1, 2, 4, 8, 7, 5, 1, 2, 4, 8, \ldots$$ When you subtract $1$ from each of these, you get a pattern that also repeats: $$1, 3, 7, 6, 4, 0, 1, 3, 7, 6, 4, 0, 1, 3, 7, \ldots$$