I'm stuck with the last question of this exercise
1) First question asks to solve the linear diophantine
$$143x-840y=1$$
based on the remark $143\times 47 - 840 \times 8 = 1$ (done)
2) second question asks to prove that if a natural $n$ is coprime with $899$, then
$$n^{840} \equiv 1 \mod 899 $$ (done using Fermat's little theorem on $31$ and $29$ knowing that $899 = 31 \times 29$)
3) This last question asks to determine an integer between $100$ and $1000$ such that
$$n^{143} \equiv 2 \mod 899$$
I proved the problem reduces to determining the remainder of $2^{47}$ when divided by $899$ wolframalpha says it's $345$ but I still can't see any elegant way to prove it.
Thanks.
It's easy mental arithmetic to compute $2^{\large 47}$ mod $31$ & $29$ then lift it to $31\cdot 29$ by CRT.
$\!\!\bmod \color{#c00}{31}\!:\ \ \,2^{\large 5}\equiv 1\,\Rightarrow\,2^{\large 47}\equiv 2^{\large 2}\equiv\color{#c00} 4$
$\!\!\bmod 29\!:\,\ 2^{\large 28}\!\equiv 1\,\Rightarrow\,2^{\large 47}\equiv 2^{\large -9}\equiv 1/(-10)\equiv 30/(-10)\equiv -3$
thus $\ {-}3\equiv 2^{\large 47}\equiv \color{#c00}{4\!+\!31}k\equiv 4\!+\!2k\iff 2k\equiv -7\equiv 22\iff\color{#0a0}{k\equiv 11\pmod{\!29}}$
Therefore: $\,2^{\large 47} = 4+31\color{#0a0}k = 4+31(\color{#0a0}{11\!+\!29}n) = 345 + 31(29n)$