# What is the 2017th digit (from the right) of $2017^{2016^{2015^{\cdots^1}}}$?

What is the value of the $2017^{\rm th}$ digit starting from right side for $${2017^{2016^{2015^{\ldots 1 }}}}?$$

My attempt: $$2017^{n} \equiv x \pmod {10^{2017}} \quad \Longrightarrow \quad { 7 }^{ n } \equiv x \pmod {{ 10 }^{ 2017 }}.$$ I stopped at this point. So, first of all "could you tell me some books which can improve my abilities in number theory" and finally I hope that you can help me to figure this question out.

• Your attempt looks incorrect to me. The modulus is a power of $10$ instead of just $10$, so you cannot just reduce the base by $10$, e.g. $3 \mod 2^3$ is not $1$. – TMM Jan 9 '17 at 9:09
• I hope that you could correct my misconception of this question. Until now I'm not able to get the final solution. – Algorthim era Jan 9 '17 at 10:22

This isn't an answer just some useful information maybe, I found ${2017^{2016^{2015^{\ldots 1 }}}}\equiv 1\pmod{2^{2017}}$ and ${2017^{2016^{2015^{\ldots 1 }}}}\equiv 2017\cdot 3^{5^{2016}}\pmod{5^{2017}}$ Now this could probably be solved by CRT with some good calculator or if combining them you get something which has less then $2017$ digits $\mod 10^{2017}$ you can check $\log_{10}$ of that must be smaller then $2016$ then you can conclude that the $2017th$ digit is $0$.
Lets try the CRT $$2017^{\varphi(2^{2017})}\equiv 1\pmod{2^{2017}}$$ Since $\varphi(2^{2017})=2^{2016}$ and $2^{2016}\mid 2016^{2015}$ we have that ${2017^{2016^{2015^{\ldots 1 }}}}\equiv 1\pmod{2^{2017}}$ We also have $\varphi(5^{2017})=4\cdot 5^{2016}$ $$2017^{\varphi(5^{2017})}\equiv 1\pmod{5^{2017}}$$ Now lets split ${2016^{2015^{\ldots 1 }}}\pmod{4\cdot 5^{2016}}$ by CRT $${2016^{2015^{\ldots 1 }}}\equiv 0\pmod{4}\\{2016^{2015^{\ldots 1 }}}\pmod{5^{2016}}$$ Now lets look at $${2015^{2014^{\ldots 1 }}}\pmod{4\cdot5^{2015}}$$ Again lets split it by CRT $${2015^{2014^{\ldots 1 }}}\equiv (-1)^{2014^{\ldots 1 }}\equiv 1\pmod{4}\\{2015^{2014^{\ldots 1 }}}\equiv 0\pmod{5^{2015}}\\{2015^{2014^{\ldots 1 }}}\equiv 5^{2015}\pmod{4\cdot 5^{2015}}$$ Now lets get back at the second equation $${2016^{2015^{\ldots 1 }}}\equiv2016^{5^{2015}}\pmod{5^{2016}}$$ By binomial theorem if we write $2016=5\cdot 403+1$ and we notice that $$5^{2015}\mid {5^{2015}\choose k}$$ for $k\not= 0,5^{2015}$ we see that the only term not divisible by $5^{2016}$ is the term $1^{5^{2015}}$ hence we have that $2016^{5^{2015}}\equiv 1\pmod{5^{2016}}$,now lets combine this equation with the one $\pmod{4}$ and we get ${2016^{2015^{\ldots 1 }}}\equiv 3\cdot 5^{2016}+1\pmod{4\cdot 5^{2016}}$ Now finally we are left with $$2017^{3\cdot 5^{2016}+1}\equiv 2017\cdot (2017^{5^{2016}})^3\pmod{5^{2017}}$$ Like last time by binomial theorem($2017=403\cdot 5+2$) we can see the only term not divisible by $5^{2017}$ is $2^{5^{2016}}$ so we have that $$2017\cdot (2017^{5^{2016}})^3\equiv 2017\cdot (2^{5^{2016}})^3\equiv 2017\cdot 8^{5^{2016}}\equiv 2017\cdot 3^{5^{2016}}\pmod{5^{2017}}$$