https://open.kattis.com/problems/tetration
We want to output aaa that satisfies:
N=aaa... N = a^{a^{a^{.^{.^{.}}}}} N=aaa...
The exponent of the right-hand-side is aa... a^{a^{.^{.^{.}}}} aa..., which is equal to NNNas well.
So, N=aN ⟹ a=N1N N = a^N \implies a = N^{\frac{1}{N}}N=aN⟹a=NN1 .
This can be implemented in C++ using the pow(base, exponent) function and doubles.
pow(base, exponent)
Last updated 4 years ago