CycleCount
The number of cycles in the disjoint-cycle decomposition of .
✓ checked against that system · ! checked, with disagreements (hover a chip)FindStat
St000031via Permutation✓CycleCount(p)the cycle count of a one-line permutation SageMath
enumeratio_stat("Permutation", p, "CycleCount")Typed signatures
| Type | Package | Applies |
|---|---|---|
(permutation) -> integer | combinatorics | always |
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
- Defined over
Permutationas an expression in_x, evaluated by compute-engine — the definition IS the implementation. - Takes a
Permutationand nothing else — it reads values against their positions, or walks the orbits, so it needs the bijection. Applying it to a bare list is a type error, not a wrong answer.
Definition
Epsil, as the implementation runs it.
on Permutation, over _x
0 if Length(_x) < 1 else Count(Filter(
Range(1, Length(_x), 1),
Function(Fold(
Function(
w if w <= 0 else 0 if w == i else -1 if w < i else _x[w],
w,
k,
),
_x[i],
Range(1, Length(_x), 1),
) == 0, i),
))Examples
Basic #
Properties #
About
| Examples | 8 |
|---|---|
| Checked against | SageMath 8 agreemathlib4 5 agree |
| Crosswalk | FindStatSageMath |
Implementation
primitive · kernela kernel — an algorithm over mutable state that would not be readable as a tree
nativeengine
typescriptpackages/symbols/combinatorics/combinatorics/collections/src/stats.ts:cycleCountOrbit traversal with a visited set — the one statistic here that does not reduce to an expression.
mapped
sagepackages/oracle/src/mappings.tsmapped
mathlib4packages/oracle/src/mappings.tsA 1-based one-line permutation list, rebuilt as an Equiv.Perm (Fin n) (a list that is not a permutation prints "not a permutation"); Equiv.Perm.partition is the cycle type with the fixed points as 1-cycles
See also: FixedPoints, StirlingS1, SymmetricGroup