LongestKOneTwoPattern
The largest k such that p has an occurrence of k 1 2 ... (k-1): a first entry above an increasing run of later, smaller ones.
✓ checked against that system · ! checked, with disagreements (hover a chip)FindStat
St000451via Permutation✓LongestKOneTwoPattern(p)The largest k such that p has an occurrence of k 1 2 ... (k-1): a first entry above an increasing run of later, smaller ones.Typed signatures
| Type | Package | Applies |
|---|---|---|
(list<integer> | permutation) -> number | combinatorics | always |
Details
- Defined over
Permutationas an expression in_x, evaluated by compute-engine — the definition IS the implementation. - Takes a
Permutation, and also a bare list of integers: this reading compares entries with each other rather than with their positions, so it stands on any sequence.
Definition
Epsil, as the implementation runs it.
on Permutation, over _x
1 if Length(_x) < 1 else 1 + Max(Map(Function(Count(Fold(
Function(Apply(
Function(
Join(a, [_x[b]]) if k > Count(a) else ReplaceAt(a, k, _x[b]),
k,
),
Count(Filter(a, Function(t < _x[b], t))) +
1,
) if b >
i &&
_x[b] <
_x[i] else a, a, b),
[],
Range(1, Length(_x)),
)), i), Range(
1,
Length(_x),
)))Examples
Basic #
Properties #
About
| Examples | 6 |
|---|---|
| Crosswalk | FindStat |