I see by your comments that you haven't learned the Chinese Remainder Th and you probably haven't learned Euler's Theorem either. (Crash course and end of post)
Without them it's harder but
$12^{32475}\pmod {21} \equiv N$ means there is an integer $k$ so that
$12^{32475} = N + k21$. So
$\frac {12^{32475}}3 = \frac N3 + k\frac {21}3$
$4*12^{32474} = \frac N3 + 7k$ and $3|N$ so let $N = 3N'$
$4*12^{32474} = N' + 7k$ Now as $12 \equiv 5 \pmod 7$ we can conclude
$N' \equiv 4*5^{32474} \pmod 7$.
Now $5^2 = 25 \equiv 4 \pmod 7$ so
$N' \equiv 4*4^{16237} \equiv 4^{16238} \pmod 7$.
And $4^2 \equiv 16 \equiv 2 \pmod 7$ so
$4^{16238}\equiv 2^{8119} \pmod 7$
And $2^3 \equiv 8 \equiv 1 \pmod 7$ so
$N' \equiv 8^{2703}*2 \equiv 1^{2703}*2 \equiv 2 \pmod 7$.
So $N = 3N' =6$ so $N \equiv 6\pmod{21}$.
=====
Chinese remainder Theorem.
If you have $x = a \pmod m$ and $x \equiv b \pmod n$ and $\gcd(m,n)=1$. Then there is unique solution what $x\pmod{mn}$.
For example if $x \equiv 2 \pmod 6$ and $x \equiv 5 \pmod 7$ then there is only one possible value for $x\pmod{42}$ where $x = 2 + 6k = 4 + 7j$ and that is $x \equiv 32 \pmod{42}$.
So if $12^{32475} \equiv 0 \pmod 3$. And $12^{32475} \equiv N \pmod 7$ whe can figure out if $x \equiv 0 \pmod 3$ and $x \equiv N \pmod 7$ then we will be able to solve $x \pmod{21}$.
Now Fermat's Little Theorem. If $p$ is a prime and $\gcd(a,p) = 1$ then $a^{p-1} \equiv 1 \pmod p$.
So $12^6\equiv 1 \pmod 7$.
So $12^{32475} = 12^{6*5412 + 3}\equiv (12^6)^{5412}*12^3\pmod 7$
$\equiv 12^3 \equiv 5^3 \equiv 25*5\pmod 7$
$\equiv 4*5 \equiv 20\equiv 6\pmod 7$.
So we have $12^{32475}\equiv 0 \pmod 3$ and $12^{32475}\equiv 6\pmod 7$.
So $x \equiv 0 \pmod 3$ and $x \equiv 6 \pmod 7$ so $x = 0+3k = 6 + 7j$ and the only solution (between $0$ and $41$) is $12^{32475}\equiv 6\pmod {21}$
======
I don't understand this: n-1= -1 mod n. Where is this from? And does this line become the next line?
Bear in mind that if $a \equiv b \pmod n$ then for any multiple of $k$ we know $a + nk\equiv a \equiv b \pmod n$.
$-1 \equiv -1 \pmod n$
So $-1 + n \equiv -1 \pmod n$
And $n-1 \equiv -1 \pmod n$.
It is certainly the case that $n|(n-1) -(-1) = n$ and that is the definition of $n-1\equiv -1\pmod n$.
The alternative definition is that there exist an integer $k$ so that $n-1 = -1 + kn$ and that is certainly true.
So $n-1 \equiv -1 \pmod n$ so $(n-1)*(n-1)\equiv (-1)*(-1) \pmod n \equiv 1\pmod n$.
...
part, I just keep factorising the exponent and use power rule of modules until I got 433 which is a prime number, so I stuck here – keanehui Nov 25 '19 at 13:10