Is there an "efficient" algorithm to compute hyperexponentation?

261 Views Asked by At

Preface: understand that this should all be modulo some fixed $m$; otherwise the numbers become so ridiculously large that the question makes no sense. That said, I'll leave $m$ off the notation to make it more clear.


Hyperexponentation can be defined recursively as follows:

$a\uparrow_n 0=1$

$a\uparrow_0 b=ab$

$a\uparrow_{n+1}b+1 = a\uparrow_n(a\uparrow_{n+1}b)$

For small $n$ you recover familiar operations: $a\uparrow_1 b=a^b$, and $a\uparrow_2 b = a^{a^{a^{\cdots a}}}$ (repeated $b$ times).

Computation is challenging. Since $a\uparrow_{n+1}b$ tends to be "quite large," computing $a\uparrow_{n+1}b+1$ is only plausible if there is an "efficient algorithm" for $\uparrow_n$.

There is such an algorithm for $a\uparrow_1b$ (exponentiation), which runs essentially in logarithmic time in $b$, which follows essentially from the fact that $a\uparrow_1 2b=(a\uparrow_1b)\uparrow_1 2$.

However, I don't see an obvious equivalent, even for $\uparrow_2$ -- while the iterative nature seems like it should work out, it doesn't seem true that $a\uparrow_2 (2b) = (a\uparrow_2 (b)) \uparrow_2 2$, or any variation of the right I can think of.

Is there a way to compute this more efficiently?

Note there may be a connection to the Ackermann function, where (at least according to Wikipedia), $A(m, n)=2\uparrow_{m-2}(n+3) - 3$.