Skip to content

CycleCount

The number of cycles in the disjoint-cycle decomposition of .

CycleCount(p)the cycle count of a one-line permutation

Domain: Permutation statistics

Details
  • Permutations of with cycles are counted by the unsigned Stirling number of the first kind (see StirlingS1)
  • The identity is all fixed points, so it splits into singleton cycles; an -cycle is a single cycle

Examples

Implementation

primitive · kernela kernel — an algorithm over mutable state that would not be readable as a tree

nativeenginetypescriptpackages/collections/src/stats.ts:cycleCount

Orbit traversal with a visited set — the one statistic here that does not reduce to an expression.

See also: FixedPoints, StirlingS1, SymmetricGroup