Tetration

Tetration, also known as hyper4, superpower, superdegree or powerlog, is a binary mathematical operator defined as \(^yx = x^{x^{x^{.^{.^.}}}}\) with \(y\) copies of \(x\). In other words, tetration is repeated exponentiation.

Daniel Geisler has created a website, tetration.org, dedicated to the operator and its properties.

Basis
Multiplication is defined as repeated addition:


 * \[x \times y = \underbrace{x + x + \ldots + x + x}_y\]

Exponentiation is defined as repeated multiplication:


 * \[x^y = \underbrace{x \times x \times \ldots \times x \times x}_y\]

Analogously, tetration is defined as repeated exponentiation:


 * \[^yx = \underbrace{x^{x^{x^{.^{.^.}}}}}_y\]

\(^yx\) is pronounced "to-the-\(y\) \(x\)" or "\(x\) tetrated to \(y\)." The notation is due to Rudy Rucker; another popular notation is \(x^④y\). \(^yx\) is equivalent to \(x \uparrow\uparrow y\) in Arrow Notation or \(\{x,y,2\}\) in BEAF.

But since exponentiation is not an associative operator (that is, \(a^{b^c}\) is generally not equal to \(\left(a^b\right)^c = a^{bc}\)), we can also group the exponentiation from bottom to top, producing what Robert Munafo calls the hyper4 operator, written \(x_④y\). \(x_④y\) reduces to \(x^{x^{y - 1}}\), which is not as mathematically interesting as the usual tetration.

Expansion
Mathematicians have not agreed on the function's behavior on \(^yx\) where y is not an integer.

Geisler found that infinite tetration on the complex plane exhibits fractal behavior similar to the Mandelbrot set, since it involves repeated exponentiation.

Examples
Here are some small examples of tetration in action:


 * \(^22 = 2^2 = 4\)
 * \(^32 = 2^{2^2} = 2^4 = 16\)
 * \(^23 = 3^3 = 27\)
 * \(^33 = 3^{3^3} = 3^{27} = 7625597484987\)
 * \(^42 = 2^{2^{2^2}} = 2^{2^4} = 2^{16} = 65536\)
 * \(^2(1/2) = (1/2)^{(1/2)} = \sqrt(1/2) = \sqrt{2}/2\)
 * \(^3(1/2) = (1/2)^{(1/2)^{(1/2)}} = (1/2)^{\sqrt{2}/2}\)

Pseudocode
Below is an example of pseudocode for tetration.

function tetration(a, b): result := 1 repeat b times: result := a to the power of result return result