So I was reading through some old questions I found
For the question I was asked to explain why for $\,2018^{\large 2017^{\LARGE n}}\!\!\bmod 1001$
Where n is an integer between 14 million and 17 million
Why are there are only 4 possible values?
So I figured it out through taking 2017$^n$ (mod 720) As 720 = phi(1001)
Using modular exponentiation I noted a few facts
2017$^1$ (mod720) ≡ 577
2017$^2$ (mod720) ≡ 289
2017$^4$ (mod720) ≡ 1
So therefore anything after this point will be congruent to 1 (mod 720)
So for example if I obtain 2017$^{15}$ = 2017$^8$ * 2017$^4$ * 2017$^2$ * 2017$^1$ Well this is just the same as 1 * 1 * 289 * 577 = 433(mod26)
And then I just finished the question by doing 2018$^{433}$ (mod 1001) ≡ 653
Now I just showed this with the 3 other patterns but basically I was wondering if there was a more elegant way to put this?
I feel like i'm there but it's not really a clean answer
Any help is appreciated.