Forms all possible permutations of the integers 1…n (J.W. McNicol & R.W. Payne).
||Whether or not to sort the permutations (
||Specifies the final number, n, in the sequence of integers 1…n to be permuted|
||Pointer to a set of variates of length
PERMUTE forms all the permutations of the integers 1 up to the value n specified by the
NVALUES parameter. The permutations are saved, as a set of variates each of length
NVALUES, in a pointer supplied by the
PERMUTATIONS parameter. By default, the permutations will occur in an arbitrary order, but option
SORT can be set to
yes to sort them into the standard (lexicographic) order.
Commands for: Calculations and manipulation.
CAPTION 'PERMUTE example',\ 'Form all permutations of the numbers 1-4.'; STYLE=meta,plain PERMUTE [SORT=yes] 4; P PRINT [IPRINT=*] P; FIELD=2; DECIMALS=0