Skip to content

StaircaseSizeOfCode ​

The largest k with a subsequence of the Lehmer code whose j-th entry from the right is at least j.

✓ checked against that system · ! checked, with disagreements (hover a chip)FindStatSt000662via Permutation✓
StaircaseSizeOfCode(p)The largest k with a subsequence of the Lehmer code whose j-th entry from the right is at least j.
Typed signatures
TypePackageApplies
(list<integer> | permutation) -> numbercombinatoricsalways

Domain: Permutation statistics

Details
  • Defined over Permutation as 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.
  • Scanning the code from the right and taking each entry that exceeds the count so far is optimal.

Definition

Epsil, as the implementation runs it.

on Permutation, over _x

0 if Length(_x) < 1 else Apply(
                                (c: list<integer>) => Fold(
                                                            Function(
                                                                      a + 1 if c[b] >
                                                                               a else a,
                                                                      a,
                                                                      b,
                                                                    ),
                                                            0,
                                                            Range(
                                                                   Length(_x),
                                                                   1,
                                                                   -1,
                                                                 ),
                                                          ),
                                Map(
                                     Function(Count(Filter(
                                                            Range(
                                                                   i + 1,
                                                                   Length(_x),
                                                                   1,
                                                                 ),
                                                            Function(_x[j] <
                                                                     _x[i], j),
                                                          )), i),
                                     Range(1, Length(_x)),
                                   ),
                              )

Examples

Basic #

the one-line word 312312

live ↗
InStaircaseSizeOfCode(Permutation⁡([3,1,2]))\mathrm{StaircaseSizeOfCode}({\operatorname{Permutation}}([3, 1, 2]))Out11

the one-line word 312312, as a plain list

live ↗
InStaircaseSizeOfCode([3,1,2])\mathrm{StaircaseSizeOfCode}(\bigl\lbrack3, 1, 2\bigr\rbrack)Out11

the one-line word 24132413

live ↗
InStaircaseSizeOfCode(Permutation⁡([2,4,1,3]))\mathrm{StaircaseSizeOfCode}({\operatorname{Permutation}}([2, 4, 1, 3]))Out11
Properties #

FindStat's value for [1]

live ↗
InCombinatorialStat(Permutation⁡([1]),StaircaseSizeOfCode)\mathrm{CombinatorialStat}({\operatorname{Permutation}}([1]), \text{StaircaseSizeOfCode})Out00

Known value · FindStat St000662

FindStat's value for [1,2]

live ↗
InCombinatorialStat(Permutation⁡([1,2]),StaircaseSizeOfCode)\mathrm{CombinatorialStat}({\operatorname{Permutation}}([1, 2]), \text{StaircaseSizeOfCode})Out00

Known value · FindStat St000662

FindStat's value for [2,1]

live ↗
InCombinatorialStat(Permutation⁡([2,1]),StaircaseSizeOfCode)\mathrm{CombinatorialStat}({\operatorname{Permutation}}([2, 1]), \text{StaircaseSizeOfCode})Out11

Known value · FindStat St000662

About
Examples6
CrosswalkFindStat