Hi.

Is it possible to prepare a set of commands, which lists elements of any size matrix in such sequence like this:

for 3x3 matrix:

$\displaystyle

\left(

\begin{array}{ccc}

a & b & c \\

d & e & f \\

g & h & i

\end{array}

\right)

$

the sequence is: $\displaystyle a, b, c, f, i, h, g, d, e$;

for matrix 4x4:

$\displaystyle

\left(

\begin{array}{cccc}

a & b & c & d \\

e & f & g & h \\

i & j & k & l \\

m & n & o & p

\end{array}

\right)

$

the sequence is: $\displaystyle a, b, c, d, h, l, p, o, n, m, i, e, f, g, k, j$,

etc.

So, the operator which forms the sequence, moves on matrix like a point drawing a spiral, independently of matrix’s size.

Thanks for all your help.