I have a homework that include a new operation (a [n] b), given:
- a [1] b = ab
- a [n] 1 = a
- 2 [2] 3 = 2 [2-1] (2 [2-1] 2)
2 repeated 3 times= 2 [1] (2 [1] 2) = 222 = 16 - 2 [2] 2 = 2 [2-1] 2
2 repeated 2 times= 2 [1] 2 = (22) = 4
- 4 [3] 3 = 4 [3-1] (4 [3-1] 4) = 4 [2] (4 [2] 4)
4 repeated 3 times= 4 [2] (4 [1] (4 [1] ( 4 [1] 4))) =
= 4 [2] 4 444
I don’t need a solution, I just need advice so that I can solve it myself.
What is being said here can be rephrased as follows.
In a C-like language
Note that the values will grow quickly and get out of the range of machine integers very soon.
Note also that
a[n]bcan be defined asusing this definition the
forloop above can be eliminated.