with(combinat): Help:=proc(): print(`redu(L)`):end: #redu(L): the reduction of the list L of distinct numbers. Try: #redu([4,1,3]); redu:=proc(L) local i,n,L1,T: n:=nops(L): L1:=sort(L): for i from 1 to n do T[L1[i]]:=i: od: [seq(T[L[i]],i=1..n)]: end: