# Math Help - 32^n = 167x + 2

1. ## 32^n = 167x + 2

Find the smallest integer n such that this statement is true for some integer x.

This is what I have so far.

32^n = 167x + 2

2^(5n) = 167x + 2

2^(5n) = 2 mod 167

Euler's Theorem: 32^(phi(167)) = 1 mod 167

32^166 = 1 mod 167

2^830 = 1 mod 167

2^831 = 2 mod 167

So, 2^(5n) = 2^831 mod 167.

How can I solve this modular equation for n?

This is from a math competition in 2008.

2. Originally Posted by elemental
Find the smallest integer n such that this statement is true for some integer x.

This is what I have so far.

32^n = 167x + 2

2^(5n) = 167x + 2

2^(5n) = 2 mod 167

Euler's Theorem: 32^(phi(167)) = 1 mod 167

32^166 = 1 mod 167

2^830 = 1 mod 167

2^831 = 2 mod 167

So, 2^(5n) = 2^831 mod 167.

How can I solve this modular equation for n?

This is from a math competition in 2008.
$\displaystyle 2^{5n}\equiv 2^{831} \bmod{167}\implies 5n \equiv 831 \bmod{\varphi(167)}$

3. What theorem is that?

4. Originally Posted by elemental
What theorem is that?
I don't know if this has a specific name or anything, but I do believe an easy proof would be a proof by contradiction.

5. Even if I do that, that yields n = 133.

However, the answer in my solution guide is n = 50.
32^50 = 2 mod 167.

Why does my method fail?

6. Originally Posted by chiph588@
$\displaystyle 2^{5n}\equiv 2^{831} \bmod{167}\implies 5n \equiv 831 \bmod{\varphi(167)}$
That's actually not accurate... The congruence is rather $5n\equiv831\pmod{83}$.

This is due to the following theorem: Suppose $a$ has order $k$ modulo $m$. Then $a^i\equiv a^j\pmod m$ if and only if $i\equiv j\pmod k$.

The order is found among the divisors of $\phi(167)$, those are $1, 2, 83,$ and $166$. In the problem we can find that $2^{83}\equiv1\pmod {167}$, so the order is $83$. (1 or 2 clearly cannot be the orders)

The congruence is reduced to $5n\equiv1\pmod {83}$... Solving this congruence gives $n\equiv{50}\pmod {83}$.

7. Originally Posted by melese
That's actually not accurate... The congruence is rather $5n\equiv831\pmod{83}$.

This is due to the following theorem: Suppose $a$ has order $k$ modulo $m$. Then $a^i\equiv a^j\pmod m$ if and only if $i\equiv j\pmod k$.

The order is found among the divisors of $\phi(167)$, those are $1, 2, 83,$ and $166$. In the problem we can find that $2^{83}\equiv1\pmod {167}$, so the order is $83$. (1 or 2 clearly cannot be the orders)

The congruence is reduced to $5n\equiv1\pmod {83}$... Solving this congruence gives $n\equiv{50}\pmod {83}$.
I made a calculation error, I thought $2$ was a primitive root modulo $167$...