Question: Tricky for loop

Hi Guys, i have a forloop problem.

I have a nxs matrix, where s=sum((k),k=1..n-1), so when n=3, s=3, when n=4,s=6 and so on.

I need to code each column number lexicographically for cartesian pair (i,j) where i<j, so when n=3, the columns would be



and when n=4 we have



I am able to create this lexicographical order independently but where i am stuck, and wondering whether it can be done is to associate the cartesian pair, with the true column number, so with the previous example

  1       2       3      4        5      6


Is it possible?

Please Wait...