Knuth’s up-arrow notation, also called Knuth’s arrow notation, is a mathematical notation for exponentiation that was launched by Donald Knuth in his e book “Concrete Arithmetic”. It makes use of a sequence of up-arrows (↑) to characterize exponentiation with numerous bases and exponents.
Strategy: Exponentiation is dependent upon the variety of arrows used within the notation. Here’s a common method for every sort of exponentiation represented by the up-arrow notation.
- One Arrow (a↑b): For any such exponentiation, the method is to multiply the bottom a by itself b occasions. That is equal to a * a * a * … * a the place there are b a‘s. .000000000000000000000000000For Instance, 5↑4 is represented as 5↑4 = 5^4 = 625
- Two Arrows (a↑↑b): For any such exponentiation, the method is to boost the bottom a to the ability of a b occasions. That is equal to a^(a^(a^(…))) the place there are b a‘s contained in the parentheses. For Instance, 3↑↑4 is represented as 3↑↑3 = 3^(3^3) = 3^27 = 7625597484987.
- Three or Extra Arrows: For any such exponentiation, the method is to carry out the exponentiation operation b occasions, with every exponentiation operation taking the earlier consequence as its base. The primary exponentiation is carried out utilizing the bottom a. For Instance, 2↑↑↑3 is represented as 2↑↑↑3 = 2↑↑(2↑↑2) = 2↑↑(2^2) = 2↑↑4 = (2^(2^(2^2))) = 2^16 = 65536
Beneath is the implementation of Knuth’s up-arrow notation:
625 7625597484987 65536
Time Complexity: O(Okay)
Auxiliary Area: O(Okay)