Well, I had written almost all of this up, and then @GohP.iHan posted a much better/shorter approach. :) I'll go ahead and post in case someone else finds it useful, but you should use his way.
Your problem, now, is that you want to compute $2014^{2014}\pmod{42}$. We can factor 2014, which should make it easier:
$$2014^{2014} = (2\cdot19\cdot53)^{2014}$$
So, we can use Euler/Fermat for $19^{2014}$ and $53^{2014}$:
\begin{align}
19^{2014}&\equiv 19^{2014\bmod \phi(42)}\pmod{42}\\
&\equiv 19^{2014\bmod 12}\\
&\equiv 19^{10}\\
&\equiv \left(19^{-1}\right)^2\equiv 31^2\\
&\equiv 37\pmod {42}
\end{align}
Note how I used that $9^{10}\equiv 19^{12}\cdot \left(19^{-1}\right)^2$; this saves me from having to do repeated-squares to evaluate the power. I use the same trick for $53^{2014}$ below:
\begin{align}
53^{2014}&\equiv 11^{10}\pmod{42}\\
&\equiv \left(11^{-1}\right)^2\equiv 23^2\\
&\equiv 25 \pmod {42}
\end{align}
Now we have that pesky $2^{2014}\pmod{42}$, where the exponent base isn't coprime to the modulus. At this point, I'll just say "use the CRT like @GohP.iHan did in his answer," because I wasn't sure how to approach that. You should have that $2^{2014} \equiv 16$.
Multiplying, we have an answer: $$2014^{2014} \equiv 16\cdot 37\cdot 25 = 14800 \equiv 16 \pmod 42$$
So, the final answer is $3^{16}\equiv 25\pmod {98} $
2^x mod 3
is congruent to-1 ^x
and how2^x mod 7
is con to2^(x mod 6)
. Could you explain this a little bit? – Somebody May 02 '15 at 21:01