9

I want to compute last few digts (as much as possible ) of the following number $$ N:=n^{n^{n^{\cdot^{\cdot^{\cdot^n}}}}}\!\!\!\hspace{5 mm}\mbox{ if there are $k$ many $n$'s in the expression and $n\in\mathbb{N}$ }$$ I have seen many particular cases of this problem. I think for odd $n$ the units digit is $n^3\mbox{ mod } 10 $ and for even $n$ the units digit is 6, for all $k\geq 3$ . How much can we say about the other digits ?

user26486
  • 11,519
pritam
  • 10,445
  • Unless you'll write out the brackets, $N$ is not clearly defined. – penartur Jul 03 '12 at 11:04
  • @penartur I dont see any problem with the definition of $N$ – pritam Jul 03 '12 at 11:10
  • 4
    $3^{(3^3)} = 3^{27} \ne 3^9 = 3^{3 \times 3} = (3^3)^3$. The operation of raising to the power is not associative. – penartur Jul 03 '12 at 11:11
  • 3
    Whilst this is true, I think the usual convention is that the brackets start from the top. So $x^{y^z}$ becomes $x^{(y^z)}$ – Sam Jones Jul 03 '12 at 11:15
  • 9
    By $n^{n^{n^n}}$ I mean $n^{(n^{(n^n)})}$ and I think this is usually meant by what I wrote – pritam Jul 03 '12 at 11:16
  • 2
    You can write it using Knuth's up-arrow notation as $n\uparrow\uparrow k$, that way there's no ambiguity. ;) – tomasz Jul 03 '12 at 12:38
  • Also, you say it's $n^3$ -- where is $k$? it is easily not true for e.g. $k=0$, or if you want $k\neq 0$, then $n=k=2$. You also need to specify what kind of answer you're expecting. There is a way to calculate all the digits: just calculate the entire expression! But that's not what you want, is it? – tomasz Jul 03 '12 at 12:41
  • @tomasz that is true for all $k\geq 4$ I have edited it. Thanks – pritam Jul 03 '12 at 12:57
  • 1
    http://math.stackexchange.com/a/162608/26068 This may be helpful – Saurabh Jul 03 '12 at 13:03
  • Basically i want know whether there are some good techniques to predict the digits without calculating the whole expression ( and i think this is not possible even for n=2 and k=10 within the lifetime of universe). – pritam Jul 03 '12 at 13:08
  • This is known as tetration and there's a forum devoted to it at http://math.eretrandre.org/tetrationforum/index.php. – Matt Groff Jul 03 '12 at 14:20
  • I realized that for even $n$ and $k\geq 3$ the units digit is different, it is 6. I edited this. – pritam Jul 03 '12 at 17:05
  • See http://oeis.org/A183613 and references there. – Robert Israel Jul 03 '12 at 18:37

3 Answers3

8

Taking $n=7$ and looking for the last three digits for an example, note that $7^m \pmod {1000}$ is periodic with period $20$. You can check this easily with a spreadsheet. So now, we only need the tower above the first $7$ to $\pmod {20}$. That has period $4$, so we only need the tower above the first two $7$'s $\pmod 4$. That has period $2$, and the stack above the bottom three $7$'s is always odd. So a tower of $k\ 7$'s has last three digits the same as $7^{7^7}$ for $ k \ge 4$. The upper $7$ is $3 \pmod 4$, so $7^7 \equiv 3 \pmod {20}$, so $7^{7^7} \equiv 343 \pmod {1000}$, so any taller tower ends in $343$

Ross Millikan
  • 383,099
3

Here's a little bit of computational knowledge...

If we want the first $d$ digits, we can calculate the result by modular arithmetic. In other words, modulo $10^d=2^d5^d$.

The more time-consuming portion is calculating the result modulo $5^m$. We can note that $$k^m \mod n \equiv k^{m \mod \phi(n)} \mod n$$ where $\phi(n)$ is Euler's Totient function.

We can apply this function recursively, i.e. $$m^m \mod n \equiv m^{m \mod \phi(n)} \mod n$$ $$m^{m^m} \mod n \equiv m^{\left(m^m \mod \phi(\phi(n))\right) \mod \phi(n)} \mod n$$ $$\dots$$ where $n=5^d$. Therefore, the most extensive operation is exponentiation modulo $n$. This can be done in $O(\log(n))$ operations via exponentiation by squaring or binary exponentiation. This operation is done at most $n$ times, so we get a conservative bound of $O(n \log(n))$ or, really, $O(5^d \log(5^d))$ operations.

Matt Groff
  • 5,749
1

Here is how to find the number of stable digits that you will get each time that you will iterate Hensel's lemma, for every $n \in \mathbb{N}_0$.
If $n$ is not a multiple of $10$, use Equation (16) of our paper Number of stable digits of any integer tetration together with the tight bounds on the preperiod stated in Section 2 of the above-mentioned paper.
If $n$ is a multiple of $10$, Equation (2) of Congruence speed of tetration bases ending with $0$ provides a simple formula to get the exact number of new (stable) trailing $0$s that you will gain from any iteration.

Marco Ripà
  • 1,292