TITLE: Find the integer x: $x \equiv 8^{38} \pmod {210}$
QUESTION [8 upvotes]: Find the integer x: $x \equiv 8^{38} \pmod {210}$
I broke the top into prime mods:
$$x \equiv 8^{38} \pmod 3$$
$$x \equiv 8^{38} \pmod {70}$$
But $x \equiv 8^{38} \pmod {70}$ can be broken up more:
$$x \equiv 8^{38} \pmod 7$$
$$x \equiv 8^{38} \pmod {10}$$
But $x \equiv 8^{38} \pmod {10}$ can be broken up more:
$$x \equiv 8^{38} \pmod 5$$
$$x \equiv 8^{38} \pmod 2$$
In the end,I am left with:
$$x \equiv 8^{38} \pmod 5$$
$$x \equiv 8^{38} \pmod 2$$
$$x \equiv 8^{38} \pmod 7$$
$$x \equiv 8^{38} \pmod 3$$
Solving each using fermat's theorem:

$x \equiv 8^{38}\equiv8^{4(9)}8^2\equiv64 \equiv 4 \pmod 5$
$x \equiv 8^{38} \equiv 8^{1(38)}\equiv 1 \pmod 2$
$x \equiv 8^{38} \equiv 8^{6(6)}8^2\equiv 64 \equiv 1 \pmod 7$
$x \equiv 8^{38} \equiv 8^{2(19)}\equiv 1 \pmod 3$

So now, I have four congruences. How can i solve them?

REPLY [2 votes]: Notice
$$8^5=210\cdot{156}+8$$
So
$$8^5\equiv8\pmod{210}--(1)$$
Also
$$8^2\equiv64\pmod{210}--(2)$$
By (1),(2) we have
$$8^7\equiv8\cdot{64}\equiv92\pmod{210}$$
Futhermore
$$8^{35}=(8^5)^7\equiv8^7\equiv92\pmod{210}--(3)$$
Morever
$$8^3\equiv512\equiv92\pmod{210}--(4)$$
Therefore, by (3),(4),
$$8^{38}=8^{35}\cdot8^3\equiv92^2\equiv64\pmod{210}$$