# The units digit of $(((\dots((2018^{2017})^{2016})^{.^{.^{.}}})^3)^2)^1$

I posted a problem, I got the answer from many guys, thanks for them.

This is another problem, I am curious how to solve it.

I tried to use modular arithmetic as in the problem linked above, but I really got confused.

How to find the units digit of $$(((\dots((2018^{2017})^{2016})^{.^{.^{.}}})^3)^2)^1$$?

What I think is: we will reach some point in $$(2018,2)$$ where the units digit of the given expression is $$0$$, then it will remains $$0$$ until we reach the power $$1$$. Therefore, the units digit of the given expression is $$0$$. I am not sure about this.

If I am right, then how to find the last non-zero digit of the given expression?

• that's just $2018^{2017!} \pmod {10}$ right? Sep 1 '19 at 5:34
• If the tower has a base of $2019$, then the units digit will be $1$, since $2018!$ is an even number, and powers of numbers ending in $9$ alternate between $9$ for odd powers and $1$ for even powers. But since there is no indicated base of the tower, I'm not sure you'd be able to determine this. Sep 1 '19 at 5:36
• @ganeshie8 hmmm, yes you are right. Sep 1 '19 at 5:36
• @AndrewChin Thanks for this, I already edited the post, the base is $2018$. Sep 1 '19 at 5:37
• Question has been edited to have an initial base of $2018$, which means the units digit would cycle among four values: $8$, $4$, $2$, $6$. Sep 1 '19 at 5:39

We have:

$$2018^{2017} \equiv 8^1 \equiv 8 \pmod {10}$$

and similarly,

$$8^{2016} \equiv 8^4 \equiv 6 \pmod {10}$$

However, $$6^n \equiv 6 \pmod {10}$$ for any natural number $$n$$, so the units digit will be just $$6$$.

If @TobyMak's powers of $$6$$ idea doesn't strike you quick, here is a dumb alternative :)

Say the units digit is $$x$$
The congruence $$x\equiv 2018^{2017!}\pmod{10}$$ is equivalent to the system $$x\equiv 2018^{2017!}\pmod{2}\\x\equiv 2018^{2017!}\pmod{5}$$ Since $$2\mid 2018$$ and $$2017!\equiv0\pmod{\phi(5)}$$ above system becomes $$x\equiv 0\pmod 2\\x\equiv 1\pmod 5$$

Solving the system gives $$x\equiv 6\pmod{10}$$

First congruence implies there exists some integer $$k$$ such that $$x=2k$$.
Plug that in second congruence and solving $$k$$ gives $$k = 3+5u$$.
$$x= 2k = 2(3+5u) = 6+10u$$