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

 

(1,2),(1,3),(2,3)

and when n=4 we have

(1,2),(1,3),(1,4),(2,3),(2,4),(3,4)

.

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

(1,2),(1,3),(1,4),(2,3),(2,4),(3,4)

Is it possible?

Please Wait...