Try this algorithm: 1) arrange the parts in columns of like magnitude 2) k <= 1 3) if well-formed stop 4) k <= k+1 5) move column k to underneath left-most column without the frequency of column k 6) go to 3) e.g. 4^2,3,2^2,1^3 Start: 4321 4.21 ...1 Move col 2 under col 1 4.21 4.21 3..1 Move col 3 under col 1 4.2. 4.2. 3... 1... 1... 1... dave