permutations (version 1.1-2)

allperms: All permutations of a given size and all cycles of a given length

Description

Function allperms() returns all n factorial permutations of a set. Function allcyc() returns all (n-1)! permutations comprising a single cycle of length n.

Usage

allperms(n)
allcyc(n)

Arguments

n

The size of the set, integer

Author

Robin K. S. Hankin

Details

Function allperms() is very basic (the idiom is word(t(partitions::perms(n)))) but is here for completeness.

References

M. C. Er 1989 “Efficient enumeration of cyclic permutations in situ”. International Journal of Computer Mathematics, volume 29:2-4, pp121-129.

See Also

allperms

Examples

Run this code

allperms(5)

allcyc(5)

Run the code above in your browser using DataCamp Workspace