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

allpermsR Documentation

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

Description

\loadmathjax

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

Usage

allperms(n)
allcyc(n)

Arguments

n

The size of the set, integer

Details

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

Note

Function allcyc() is taken directly from Er's “fine-tuned” algorithm. It should really be implemented in C as part of the partitions package but I have not yet got round to this.

Author(s)

Robin K. S. Hankin

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


allperms(5)

allcyc(5)


permutations documentation built on March 7, 2023, 8:26 p.m.