subroutine permut(l,n,r) * ====== * Permutations of array r(n) * -------------------------- * l = ordinal number (input) * n = number of entries in: (input) * r = row of permutations (output) * implicit integer (a-z) dimension r(n) * ... Init: h=1 do 5 k=1,n h=h*k 5 r(k)=k * ... Body: do 10 k=1,n p=n-k+1 h=h/p q=mod((l-1)/h,p)+1 if(q.eq.1) goto 10 * ... Rotate data: s=r(k+q-1) do 25 m=k+q-1,k+1,-1 25 r(m)=r(m-1) r(k)=s 10 continue return end