# Finding the unit digit of the following expressions, A and B.

Let A be:$${2013}^{{2012}^{{2011}^{2010.....}}}$$

This, goes, on, till, $3^{{2}^1}$

Let B be:$${2012}^{{2011}^{{2010}^{2009.....}}}$$

This, goes, on, till, $3^{{2}^1}$,

For A , I did this,

Let f(x) denote , unit digit of x,

$$f(A)=f(2013)^{4s}=f(3)^{4s}=1$$

For B i did this,

$$f(B)=f(2012)^{{(4s-1)}^{4t}}=f(2012)^{4u+1}=2$$

Is my approach right?

-
I made sure to show all my working this time. – Tomarinator Mar 18 '12 at 18:45
It needs a bit more explanation, and the second term in the last line should be $f(2012)^{(4s-1)^{4t}}$, with parentheses around the lower exponent, but yes, the implied reasoning is correct. – Brian M. Scott Mar 18 '12 at 18:54
I edited that parenthesis thing, apart from that what more explanation does this needs @BrianM.Scott – Tomarinator Mar 18 '12 at 18:58
@5T0M, your approach is right. – quartz Mar 18 '12 at 19:07
@5T0M: I’ll write up an answer the way that I’d like to see a student explain it. – Brian M. Scott Mar 18 '12 at 19:21

For any integer $n$ let $f(n)$ denote the unit digit of $n$. Since $2012$ is a multiple of $4$, so is any power of $2012$, and therefore $A$ is of the form $2013^{4s}$ for some positive integer $s$. Thus, $$f(A)=f(2013^{4s})=f(3^{4s})=f(81^s)=f(1^s)=1\;.$$

For $B$, note that $2011=4s-1$ for some integer $s$. Moreover, $2010$ is even, so $B$ is of the form $2012^{(4s-1)^{2t}}$ for some positive integers $s$ and $t$. Now $(4s-1)^2=4(4s^2-2s)+1$ is of the form $4u+1$ for some positive integer $u$, and any positive power of $4u+1$ is of the same form, so without loss of generality $$f(B)=f(2012^{(4u+1)^t})=f(2^{4u+1})=f(2\cdot 16^u)\;.$$ It’s easy to see that $f(16^u)=6$ for all $u\in\Bbb Z^+$, so $f(B)=f(2\cdot 6)=2$.

-

Yes, your approach is right. You can also solve it "recursively" with Euler's theorem, which says that for any $a,x,y,k,$

$$x \equiv y \bmod \phi(k) \ \Rightarrow \ a^x \equiv a^y \bmod k.$$

In this case you want to find $A = 2013^{2012^{\ldots}} \bmod 10$ and $B = 2012^{2011^{\ldots}} \bmod 10$. For $A$ we apply the above with $k = 10$ and $\phi(k) = 4$ to get:

$$2012^{2011^{\ldots}} \equiv 0 \bmod 4 \ \Rightarrow \ 2013^{2012^{\ldots}} \equiv 2013^0 \equiv 1 \bmod 10.$$

Applying the above twice, starting with $k = 10$ (so that $\phi(k) = 4$ and $\phi(\phi(k)) = 2$), for $B$ we get

$$2010^{2009^{\ldots}} \equiv 0 \bmod 2 \ \Rightarrow \ 2011^{2010^{\ldots}} \equiv 2011^0 \equiv 1 \bmod 4 \ \Rightarrow \ 2012^{2011^{\ldots}} \equiv 2012^1 \equiv 2 \bmod 10.$$

In other words:

$$\displaystyle a^{\displaystyle b^{\displaystyle c^{\displaystyle d^{\ldots}}}} \equiv (a \bmod k)^{\displaystyle (b \bmod \phi(k))^{\displaystyle (c \bmod \phi^2(k))^{\displaystyle (d \bmod \phi^3(k))^{\ldots}}}} \bmod k,$$

where e.g. $\phi^3(k) = \phi(\phi(\phi(k)))$. Applying this to $A$ we get

$$2013^{\displaystyle 2012^{\ldots}} \equiv (2013 \bmod 10)^{\displaystyle (2012 \bmod 4)^{\ldots}} \equiv 4^{\displaystyle 0^{\ldots}} \equiv 1 \bmod 10,$$

and for $B$ we get

$$2012^{\displaystyle 2011^{\displaystyle 2010^{\ldots}}} \equiv (2012 \bmod 10)^{\displaystyle (2011 \bmod 4)^{\displaystyle (2010 \bmod 2)^{\ldots}}} \equiv 2^{\displaystyle 3^{\displaystyle 0^{\ldots}}} \equiv 2 \bmod 10.$$

-