# Nested exponent modulus, $2^{2^{517}} \pmod {23}$

I have had a go at this for a while now and can't seem to get anywhere.

$$2^{(2^{517})} \pmod {23}$$

I see that Fermat's Little Theorem must come into play but I can't see where to pull $$22$$ from. Any help would be appreciated.

Here is my attempt:

$$2^{(2^{517} \!\!\mod {22})} \equiv 2^{(2^{517})} \pmod {23}$$ Then proceed to do Chinese remainder theorem to find the exponent?

• Take $2^{517}$ mod $22$ as your new exponent – TokenToucan Mar 14 '16 at 3:44

Note that $2^{11}=2048\equiv1\pmod{23}$
Next note that: $2^{10}=1024\equiv1\pmod{11}$
So $2^{2^{517}}\equiv2^{2^7}\pmod{23}$ as $2^{517}\equiv2^7\pmod{11}$
Hence $2^{2^{517}}\equiv2^{128}\pmod{23}\equiv2^7\pmod{23}=128\equiv13\pmod{23}$