Find $3^{333} + 7^{777}\pmod{ 50}$ As title say, I need to find remainder of these to numbers. I know that here is plenty of similar questions, but non of these gives me right explanation. I always get stuck at some point (mostly right at the beginning) and don't have idea how to start. 
Thanks in advance. 

First, let us compute $\varphi(50)=\varphi(2\cdot 25)=\varphi(2)\varphi(25)=20$.  By Euler's theorem, if $a$ is relatively prime to 50, $a^{20}\equiv 1 \pmod{50}$.   Therefore
$$3^{333}+7^{777}\equiv 3^{16*20+13}+7^{38*20+17}=1^{16}*3^{13}+1^{38}*7^{17}\pmod{50}.$$
Thus, we have reduced the problem to computing $3^{13} \pmod{50}$ and $7^{17}\pmod{50}$.  There are a number of ways to proceed from here, but one that I like is repeated squaring.  I will demonstrate the procedure for one of the terms.
Write $13$ in base $2$ as $13=8+4+1=1+2(2(1+2))$.  Then $3^{13}=3*((3^{1+2})^2)^2$.  We then compute $3^3=27$, $27^2\equiv 29\pmod{50}$, $29^2\equiv (-21)^2\equiv 41 \equiv -9 \pmod{50}$, and finally $3*(-9)\equiv -27 \pmod{50}$.  With this method, we can compute $a^b \pmod{n}$ in less than $2\log_2 \varphi(n)$ steps where each step is either a squaring or a multiplication by $a$, and we never have any intermediate terms bigger than $n^2$.
