Re: Problem with nested for-loops



<un.student@xxxxxxxxx> wrote ...
The idea was to generate a hierarchy of operations. The base level was
supposed to be addition by one, i.e. successor-function. The next
level multiplication, next exponentiation etc.

You probably want successor to be followed by addition, then by
multiplication, etc., which is an Ackermann hierarchy of operators.
Google "Ackermann function" and "Ackermann hierarchy" for recursive
definitions.

If we had just (3) this would lead to i=3, if (3,4) then i = 3*4 = 12,
if (3,4,2) i = (3*4)^2 = 12^2=144, if (3,4,2,3) i = 144^144^144 etc.

Let [n] denote the nth operation (n=1,2,3...) in the hierarchy
that's often written with Knuth arrows as +,*,^,^^,^^^, etc.

Let's use angle-brackets to denote your tuples, allowing parentheses
for grouping. You seem to be looking at the following recursively
defined objects, with the k_i being positive integers:

<> = 0
<k_1, ..., k_n> = <k_1, ..., k_(n-1)> [n] k_n (n=1,2,3,...)

Thus,

<k_1> = <> [1] k_1 = 0 + k_1 = k_1
<k_1, k_2> = <k_1> [2] k_2 = k_1 * k_2
<k_1, k_2, k_3> = <k_1, k_2> [3] k_3 = (k_1 * k_2) ^ k_3
<k_1, k_2, k_3, k_4> = <k_1, k_2, k_3> [4] k_4 = ((k_1 * k_2) ^ k_3)^^k_4
etc.


Now if arity of the tuple and i were given, how would one find the
tuple? Would it be unique (in the non-trivial sense)?

Consider n=3, and i = 8 = <1,2,3> = <8,1,1> = etc.
.