BulgarianSolitairePreperiod
The steps of Bulgarian solitaire before this partition reaches the cycle it ends in.
✓ checked against that system · ! checked, with disagreements (hover a chip)FindStat
St001912via IntegerPartition✓BulgarianSolitairePreperiod(partition)The steps of Bulgarian solitaire before this partition reaches the cycle it ends in.Typed signatures
| Type | Package | Applies |
|---|---|---|
(integer_partition) -> number | combinatorics | always |
Details
- Defined over
IntegerPartitionas an expression in_x, evaluated by compute-engine — the definition IS the implementation. - Takes a
IntegerPartitionand 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 IntegerPartition, over _x
0 if Length(_x) < 1 else Apply(
(c: list<integer>) => Apply(
(p: integer) => Sum(Fold(
Function([
Map(Function((a[1][j + 1] if j < Sum(_x) else 0) +
(1 if j == Sum(a[1]) else 0), j), Range(1, Sum(_x))),
Map(Function((a[2][j + 1] if j < Sum(_x) else 0) +
(1 if j == Sum(a[2]) else 0), j), Range(1, Sum(_x))),
[a[3][1] +
Min(1, Sum(Map(
Function(Abs(a[1][j] - a[2][j]), j),
Range(1, Sum(_x)),
)))],
], a, b),
[
Map(
Function(Count(Filter(
Range(1, Length(_x)),
Function(_x[p] == j, p),
)), j),
Range(1, Sum(_x)),
),
Fold(
Function(Map(Function((a[j + 1] if j < Sum(_x) else 0) +
(1 if j == Sum(a) else 0), j), Range(1, Sum(_x))), a, b),
Map(
Function(Count(Filter(
Range(1, Length(_x)),
Function(_x[p] == j, p),
)), j),
Range(1, Sum(_x)),
),
Range(1, p, 1),
),
[0],
],
Range(1, Sum(_x) *
(Sum(_x) + 1) +
1, 1),
)[3]),
Min(Filter(
Range(1, Sum(_x)),
Function(Sum(Map(Function(Abs(Fold(
Function(Map(Function((a[j + 1] if j < Sum(_x) else 0) +
(1 if j == Sum(a) else 0), j), Range(1, Sum(_x))), a, b),
c,
Range(1, l, 1),
)[j] -
c[j]), j), Range(1, Sum(_x)))) ==
0, l),
)),
),
Fold(
Function(Map(Function((a[j + 1] if j <
Sum(_x) else 0) +
(1 if j == Sum(a) else 0), j), Range(
1,
Sum(_x),
)), a, b),
Map(
Function(Count(Filter(
Range(
1,
Length(_x),
),
Function(_x[p] ==
j, p),
)), j),
Range(1, Sum(_x)),
),
Range(1, Sum(_x) * (Sum(_x) + 1), 1),
),
)Examples
Properties #
About
| Examples | 5 |
|---|---|
| Crosswalk | FindStat |