ColoredPermutations
Permutations of with each position colored by one of colors — the wreath product . Element is a pair.
✓ checked against that system · ! checked, with disagreements (hover a chip)OEIS
A337997✓ColoredPermutations(n, k)the colored permutations of Typed signatures
| Type | Package | Applies |
|---|---|---|
(integer<0..>, integer<0..>) -> indexed_collection<list<list<integer>>> | combinatorics | always |
Definition
Epsil, as the implementation runs it.
count(_n, _k)
1 if _n == 0 else _k ^ _n * _n!unrank(_n, _k, _r)
[
Map(Function(Fold(
Function(v + 1 if v >= (_r % _n! - _r % _n! % (_n - i)!) /
(_n - i)! % (_n - i + 1) + 1 else v, v, i),
(_r % _n! - _r % _n! % (_n - j)!) / (_n - j)! %
(_n - j + 1) + 1,
Range(j - 1, 1, -1),
), j), Range(1, _n, 1)),
Map(Function(((_r - _r % _n!) / _n! - (_r - _r % _n!) / _n! % _k ^ (_n - j)) /
_k ^ (_n - j) % _k, j), Range(1, _n, 1)),
]rank(_n, _k, _x)
Fold(Function(c * _k + _x[2][j], c, j), 0, Range(1, _n, 1)) * _n! + Fold(
Function(r *
(_n - j +
1) +
(_x[1][j] - 1 -
Fold(
Function(c +
(1 if _x[1][i] < _x[1][j] else 0), c, i),
0,
Range(1, j - 1, 1),
)), r, j),
0,
Range(1, _n, 1),
)valid(_n, _k, _x)
((Fold(Function(
(ReplaceAt(di_seen, _x[1][di_j], 1) if di_seen[_x[1][di_j]] ==
0 else ReplaceAt(
di_seen,
_n + 1,
1,
)) if 1 <=
_x[1][di_j] &&
_x[1][di_j] <=
_n else ReplaceAt(di_seen, _n + 1, 1),
di_seen,
di_j,
), Map(Function(0, di_z), Range(1, _n + 1, 1)), Range(1, _n, 1))[_n +
1] ==
0 && Fold(
Function(ok && 0 <= _x[2][j] && _x[2][j] <= _k - 1, ok, j),
True,
Range(1, _n, 1),
) if Length(_x[2]) == _n else False) if Length(_x[1]) == _n else False) if Length(_x) == 2 else FalseExamples
About
| Examples | 2 |
|---|---|
| Crosswalk | OEIS |
See also: SignedPermutations