16
1
Tetration, represented as
a^^b
, is repeated exponentiation. For example,2^^3
is2^2^2
, which is 16.
Given two numbers a and b, print a^^b
.
Test cases
1 2 -> 1
2 2 -> 4
5 2 -> 3125
3 3 -> 7625597484987
etc.
Scientific notation is acceptable.
Remember, this is code-golf, so the code with the smallest number of bytes wins.
2What kind of numbers? Positive integers? – xnor – 2016-10-22T00:42:05.017
Related – acrolith – 2016-10-22T00:43:17.927
9Exponentiation is non-associative. You should include at least one test cade with b > 2. – Dennis – 2016-10-22T01:02:32.843
@Dennis
3 3 -> 7625597484987
– Gabriel Benamy – 2016-10-22T01:12:00.323Can I get the inputs reversed? – Erik the Outgolfer – 2016-10-23T16:43:27.810
@EriktheGolfer Yes – Oliver Ni – 2016-10-23T20:06:53.683
What are the two downvotes for? – Oliver Ni – 2016-10-24T17:57:24.957
So 3^3^3 is 3^(3^(3)) and not (3^3)^3 you have to put () – RosLuP – 2016-11-17T15:36:34.403
1
@RosLuP No,
– Oliver Ni – 2016-11-17T16:10:26.2573^3^3
automatically means3^(3^(3))
. See https://en.wikipedia.org/wiki/Order_of_operations, where it says "Stacked exponents are applied from the top down, i.e., from right to left."Related. – mbomb007 – 2016-12-23T14:47:46.747