For any positive integer $n$ which is not specified a priori, I can make $n$-tuple vector $v$ by v = Array[a, 1, n]. Now, given that $n$ is a positive integer which is not specified a priori, I want to write an iteration sentence which performs over $1\leq a_1,\ldots, a_n\leq 3$. ($a_i$ are integers and hence I will get $3^n$ iterations).
For example, if $n=2$, my sentence plays the same role as the following loop:
Do[EXPERIMENT, {i, 3}, {j, 3}]
If $n=3$, my sentence plays the same role as the following:
Do[EXPERIMENT, {i, 3}, {j, 3}, {k, 3}].
I can do it for any given SPECIFIED integer $n$, but I want to write the universal looping sentence which iterates for $1\leq a_1,\ldots, a_n\leq 3$ ($a_i$ are integers.)
f[n_] := Module[{i = 1}, Do[Print@i++, Evaluate[Sequence @@ Thread[List[Array[a, n], 1, 3]]]]]; f[4]– Dr. belisarius May 19 '13 at 21:25