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".