The hyperexponentiation of a number

Problem 188

The hyperexponentiation or tetration of a number $a$ by a positive integer $b$, denoted by $a↑↑b$ or $^ba$, is recursively defined by:

$$a↑↑1 = a,$$$$a↑↑(k+1) = a^{(a↑↑k)}.$$

Thus we have e.g. $3↑↑2 = 3^3 = 27$, hence $3↑↑3 = 3^{27} = 7625597484987$ and $3↑↑4$ is roughly $10^{3.6383346400240996*10^{12}}$.

Find the last $8$ digits of $1777↑↑1855$.


In [1]:
open Euler

let p188() =
    let rec loop (n:bigint) k = 
        match k with
        |1 -> n
        |_ -> bigint.ModPow(n,loop n (k-1),100000000I)
    loop 1777I 1855

Euler.Timer(p188)


Out[1]:
val it : bigint * float = (95962097, 0.0109785)

In [ ]: