I recently did a coding challenge which asked for all numbers $n$ in a range which fulfill:
- $n = 2^x$
- $n = 1\bmod 7$.
By playing around my impression is that $2^x \equiv 1\bmod 7 \iff x\equiv 0\bmod 3$.
The assumption certainly held for the ranges tested in the challenge.
I have been able to prove the hypothesis one way ($x\equiv 0\bmod 3 \implies 2^x \equiv 1\bmod 7$):
$2^x \equiv 1\bmod 7 \rightarrow 2^{3k} \equiv 1\bmod 7 \rightarrow (2^{3})^{k} \equiv 1\bmod 7 \rightarrow 1^{k} \equiv 1\bmod 7$
I am curious about how to prove it the other way, or a counter-example if it doesn't hold in reality (I haven't found any by brute forcing on my machine for a bit).
I only know the rudimentaries of modular arithmetic, so I would appreciate, if possible, answers which do not rely on advanced theorems.