How do you calculate: $54^{2013}\pmod{280}$?
I'm stuck because $\gcd(54,280)$ is not $1$. Thanks.
How do you calculate: $54^{2013}\pmod{280}$?
I'm stuck because $\gcd(54,280)$ is not $1$. Thanks.
$$54^{2013}=27^{2013}\cdot2^{2013}=3^{6039}\cdot 2^{2013}$$
Now $3^{6039}$ is not a problem modulo $280$, and you should not have much difficulty reducing $2^{2013}$ even by hand - starting e.g. $2^8=256\equiv -24$, then $2^{16}\equiv (-24)^2=576\equiv 16$
$280=2^3\cdot 5\cdot 7$. As usual, the following Chinese Remainder Theorem algorithm is straightforward. Here we didn't need Euler's Theorem, but it is often useful.
Clearly $54^{2013}=8k$ for some $k\in\Bbb Z$. Then $$54^{2013}\equiv (-1)^{2013}\equiv -1\equiv -6\equiv 8k\equiv 3k\pmod{\!5}$$
$$\stackrel{:3}\iff k\equiv -2\equiv 3\pmod{\! 5}\iff k=5m+3$$ for some $m\in\Bbb Z$. Then $54^{2013}=8k=8(5m+3)=40m+24$.
$$54^{2013}\equiv (-2)^{2013}\equiv -(2^3)^{671}\equiv -(1)^{671}\equiv -1\pmod{\! 7}$$
$$\iff -1\equiv 40m+24\equiv -2m+3\iff -2m\equiv -4\stackrel{:(-2)}\iff m\equiv 2\pmod{\! 7}$$
$\iff m=7a+2$ for some $a\in\Bbb Z$. Then $54^{2013}=40(7a+2)+24=280a+104$.
As $280=2^3\cdot5\cdot7$
let us start with $54^{2013-3}\pmod{\dfrac{280}{2^3}}$ i.e., $54^{2010}\pmod{35}$
Now $54\equiv-1\pmod5\implies54^2\equiv(-1)^2\equiv1$
and $54\equiv-2\pmod7\implies54^3\equiv(-2)^3\equiv-1,54^6\equiv(-1)^2\equiv1$
$\implies54^6\equiv1\pmod{35}$
As $2010\equiv0\pmod6,54^{2010}\equiv54^0\pmod{35}\equiv1$
As $a\equiv b\pmod m\implies a\cdot c\equiv b\cdot c\pmod{m\cdot c}\ \ \ \ (1)$
$54^{2010}\cdot54^3\equiv1\cdot54^3\pmod{35\cdot54^3}$
As $280|35\cdot54^3,54^{2010+3}\equiv54^3\pmod{280}$
Again as $54=2\cdot3^3,54^3=\cdots=2^33^9$
and $3^3\equiv-8\pmod{35},8=2^3;3^9\equiv-(2^3)^3\equiv-2^9$
Now $2^7\equiv-12\pmod{35}\implies2^9\equiv-12\cdot2^2\equiv-13$
$\implies3^9\equiv13\pmod{35}$
Using $(1),54^3=2^3\cdot3^9\equiv2^3\cdot13\pmod{2^3\cdot35}\equiv104$
You can also use quick exponentiation (also known as exponentiation by squaring), which is a very common and useful but, in this specific case, a bit brute method. Take the binary expansion of the exponent $2013=2^{10}+2^9+2^8+2^7+2^6+2^4+2^3+2^2+2^0$ and then do repeated squaring of $54$ to get $54^1,54^2,54^{2^2},\dots,54^{2^{10}}$. In every step you can take the least positive number in the residue class so normally it gives you relatively small numbers to deal with.
If you need more details, let me know.