Basic Modulo Question I've been having trouble with this example while studying for my exams. Why is 
$$2023^{2297}\equiv 20 \pmod{3953}\;?$$ 
Thanks so much for any help I can get!
The examples solves the answer by using $2297 = 2^{11} + 2^7 + 2^6 + 2^5 + 2^4 + 2^3 + 2^2 + 2^0$
 A: Here is how I would approach the problem: the factorization of $3953$ is $59\times 67$ (hopefully you're allowed to use a calculator or Mathematica for this). I'd find the solutions $a$ and $b$ to
$$2023^{2297}\equiv 17^{2297}\equiv 17^{35} \equiv a\bmod 59\qquad 2023^{2297}\equiv 13^{2297}\equiv 13^{53}\equiv b\bmod 67$$
(note the use of Fermat's little theorem here). Unfortunately nothing about these numbers is particularly convenient, so I'd resort to repeated squaring to figure out $a$ and $b$. Finally, I'd use the Chinese remainder theorem to combine these results into an answer modulo $3953$.
A: This is not an answer, it is just a rescue part of Zev Chonoles' factoring. I couldn't include this in the comment, as it is exceeding word-limit.
$3953$ is your number. The square root of the number is approximately $62$, so you just gotta check the PRIME numbers until $62$ to find the factors. And the rest follows.
Why this works?
If you have a number $N$, write it as 
$\sqrt{N} \cdot \sqrt{N}$ , if you choose any number below $\sqrt {N}$, the other number has to be larger than $\sqrt{N}$. So, if you get numbers until $\sqrt{N}$, obviously you will have the other number larger than $\sqrt{N}$, which you don't need to check.
A: The point of the example is to show the use of repeated squaring.  Once you write $2297 = 2^{11} + 2^7 + 2^6 + 2^5 + 2^4 + 2^3 + 2^2 + 2^0$ you can do $x^{2297}=x^{(2^{11} + 2^7 + 2^6 + 2^5 + 2^4 + 2^3 + 2^2 + 2^0)}=x^{2^{11}}x^{2^7}x^{2^6}x^{2^5}x^{2^4}x^{2^3}x^{2^2}x$ and you can get each of the last terms by squaring $x \ 11$ times, taking it $\pmod {3957}$ each time.  Then you can multiply two of them, take it $\pmod {3957}$, multiply by the next, take it $\pmod {3957}$, and so on.  You never need numbers of more than eight digits this way.
