# Last digits of n^(n-1)^(n-2)^(n-3) and so on.

If given $n$, how would I get the last digits of $n^{{n-1}^{{n-2}^{\dots}}}$, for example $$5^{\displaystyle4^{3^2}}.$$

As far as I've gotten is that the last digits tend to repeat after a while, but I don't know where to go from there.

For $6$ the last two repeating digits ($n^i \pmod{100}$) are $$36\ 16\ 96\ 76\ 56.$$

• Do you have any numerical data to contribute? – Ian Coley Feb 3 '15 at 8:34
• Rather easier for $n=10$ than $n=7$ – Henry Feb 3 '15 at 8:52

The repetition is after the 4th power,i.e.,

Last digit of $n^k$ = Last digit of $n^{k+4}$ = Last digit of $n^{k+8}$ and so on...

You can express $n^{(n-1)^{(n-2)...}}$ as $n^{4k+m} \forall k \in$Whole Numbers , $m\in \{0,1,2,3\}$

For e.g. if you have $n = 5$, you get $5^{4^{3}...}$ which is $5^{4^{integer}}$ which can be written as $5^{4*integer} = 5^{4*integer}$ and that integer is = $k$ thus $m$ being zero.

Here $k$ is not of use but $m$ is.

Here's the link for reference of $n$ and $m$: http://www.iiti.tk/tab.html

The value's under m give the value of last digit.

For instance taking $n=12$, we get the exponential part as $11^{10^{9^{8^{7...}}}}$ which is either $4k+3$ or $4k+1$ (being odd). Next, utilising Remainder theorem, we deduce that it is $4k+1$ for even powers of 11 and $4k+3$ for odd powers of 11. Since the power of 11 is even ($10^{integer}$ is even), thus it is of the form $4k+1$.

So we get n=12 and last digit of n is 2 and $m = 1$, we get the last digit of the expression as 2.

• Could you explain what k and m mean? And is there a name to this property? – Kaspars Feb 3 '15 at 8:47
• I hope you understand what I mean to write, or should I explain further?@Kaspars – Kunal Gupta Feb 3 '15 at 9:21
• That works for the last digit, but what would change to find the last 2 digits? – Kaspars Feb 3 '15 at 9:44
• It will be long, consider last digit as 2, you get : 02,04,08,16,32,64,28,56,12,24,48,96,92,84,68,36 and so on... – Kunal Gupta Feb 3 '15 at 12:26