Solve an exponential congruence equation

modular arithmetic

The question is rather simple, but I spent the entire afternoon googling and found no help in order to solve such questions:

$$2^x \equiv 16 \pmod{127}$$

What are the general steps to solve such questions? I've tried looking for some materials, but they are either about explaining modular arithmetics with clocks, or they solve simple congruence equations, but no were like this.

I've been adviced this (but the implication along with the equivalence make no sense to me):

$$2^7 \equiv 16 \pmod{127}\implies \left(2^x \equiv 16 \pmod{127} \iff x \equiv4 \pmod{7}\right)$$

Best Answer

As a hint:" $$2^7 \equiv 128 \pmod{127}\equiv 1 \pmod{127}\\\implies 2^{7+4} \equiv 128\times 16 \pmod{127}\equiv 16 \pmod{127}\\\implies 2^{7n+4} \equiv (128)^n\times 16 \pmod{127}\equiv 16$$