1

I recently did a coding challenge which asked for all numbers $n$ in a range which fulfill:

  1. $n = 2^x$
  2. $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.

Bill Dubuque
  • 272,048
  • 3
    The order of $2\pmod 7$ is $3$, and this implies what you want.If you want to prove this from scratch, suppose that $2^n\equiv 1 \mod 7$ for $n=3k+1$ (resp. $3k+2$). Show that this would tell you that $2^1$ (resp. $2^2$) was $1 \pmod 7$, hence a contradiction. – lulu Jan 18 '24 at 12:33
  • Thank you very much! I didn't realise there were only two other concrete possibilities that I could manually check and reach contradictions, seems obvious in hindsight. Would you mind expanding on why the order of the group implies what I want? Feel free to post as an answer too! – user2891462 Jan 18 '24 at 12:37
  • 1
    I gave you the argument...it works generally. And you don't need to check each case separately. In general, if $g$ is the least natural number such that $a^g\equiv 1\pmod p$ then, if $a^n\equiv 1 \pmod p$ write $n=g\times k+r$ with $r\in {0,\cdots, p-1}$ and argue that $a^r\equiv 1 \pmod p$, contradicting the minimality of $g$ unless $r=0$. You can work all this out yourself...no complicated methods needed. – lulu Jan 18 '24 at 12:42
  • 1
    See mod order reduction in the linked dupe. – Bill Dubuque Jan 18 '24 at 13:07

0 Answers0