Skip to content

MajorIndex ​

The major index of pp: the sum of the descent positions ∑pi>pi+1i\sum_{p_i > p_{i+1}} i.

✓ checked against that system · ! checked, with disagreements (hover a chip)FindStatSt000290via BinaryWord✓St000769via IntegerComposition✓St000004via Permutation✓St000330via StandardTableau✓
MajorIndex(p)the major index of a one-line permutation pp
CombinatoricaIndex[p]SageMathenumeratio_stat("Permutation", p, "MajorIndex")
Typed signatures
TypePackageApplies
(binary_word | composition | dyck_path | list | permutation | standard_tableau) -> integer | numbercombinatoricsalways

Domain: Permutation statistics

Details
  • Introduced by MacMahon, who proved it equidistributed with Inversions over SnS_n
  • Both are Mahonian, so their common generating function is the q-factorial [n]q![n]_q!
  • 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.
  • The distinction from Descents is the entire content of the statistic.
  • A separate definition exists for DyckPath (The sum of the descent positions of the step word — where an up step is followed by a down step.) but is not the one declared: one head, one owner.

Definition

Epsil, as the implementation runs it.

on Permutation, over _x

0 if Length(_x) < 2 else Sum(Filter(
                                     Range(1, Length(_x) - 1),
                                     Function(_x[i] > _x[i + 1], i),
                                   ))

on DyckPath, over _x

0 if Length(_x) < 2 else Sum(Filter(
                                     Range(1, Length(_x) - 1),
                                     Function(_x[i] == 1 && _x[i + 1] == 0, i),
                                   ))

on IntegerComposition, over _x

0 if Length(_x) < 2 else Sum(Filter(
                                     Range(1, Length(_x) - 1),
                                     Function(_x[i] > _x[i + 1], i),
                                   ))

on BinaryWord, over _x

0 if Length(_x) < 2 else Sum(Filter(
                                     Range(1, Length(_x) - 1),
                                     Function(_x[i] > _x[i + 1], i),
                                   ))

Examples

Basic #

one descent, at position 1

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

descents at positions 1 and 2

live ↗
InMajorIndex([3,2,1])\mathrm{MajorIndex}(\bigl\lbrack3, 2, 1\bigr\rbrack)Out33

no descents

live ↗
InMajorIndex([1,2,3])\mathrm{MajorIndex}(\bigl\lbrack1, 2, 3\bigr\rbrack)Out00

the one-line word 312312

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

the one-line word 312312, as a plain list

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

the one-line word 24132413

live ↗
InMajorIndex(Permutation⁡([2,4,1,3]))\mathrm{MajorIndex}({\operatorname{Permutation}}([2, 4, 1, 3]))Out22

the standard tableau with rows 13∣2413 \mid 24, whose descents are 11 and 33

live ↗
InCombinatorialStat(StandardTableau⁡([[1,3],[2,4]]),MajorIndex)\mathrm{CombinatorialStat}({\operatorname{StandardTableau}}([[1, 3], [2, 4]]), \text{MajorIndex})Out44
Properties #

FindStat's value for [1]

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

Known value · FindStat St000004

FindStat's value for [1,2]

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

Known value · FindStat St000004

FindStat's value for [2,1]

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

Known value · FindStat St000004

About
Examples10
Checked againstCombinatorica 6 agreeSageMath 9 agree
CrosswalkFindStat ×4CombinatoricaSageMath

Implementation

referenceenginenotatio

Checked against the implementation over every permutation of 1..6.

nativeenginetypescriptpackages/symbols/combinatorics/combinatorics/collections/src/stats.ts:majorIndex
mappedcombinatoricapackages/oracle/src/mappings.ts

Combinatorica's Index is the major index: the sum of the descent positions, 1-based, as ours.

mappedsagepackages/oracle/src/mappings.ts

See also: Inversions, Descents, SymmetricGroup