*****************************************************************************
*       www.FindStat.org - The Combinatorial Statistic Finder               *
*                                                                           *
*       Copyright (C) 2019 The FindStatCrew <info@findstat.org>             *
*                                                                           *
*    This information is distributed in the hope that it will be useful,    *
*    but WITHOUT ANY WARRANTY; without even the implied warranty of         *
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                   *
*****************************************************************************

-----------------------------------------------------------------------------
Statistic identifier: St000958

-----------------------------------------------------------------------------
Collection: Permutations

-----------------------------------------------------------------------------
Description: The number of Bruhat factorizations of a permutation.

This is the number of factorizations $\pi = t_1 \cdots t_\ell$ for transpositions $\{ t_i \mid 1 \leq i \leq \ell\}$ such that the number of inversions of $t_1 \cdots t_i$ equals $i$ for all $1 \leq i \leq \ell$.

-----------------------------------------------------------------------------
References: 

-----------------------------------------------------------------------------
Code:
@cached_function
def bruhat_poset(n):
    return Permutations(n).bruhat_poset(facade=True)

def statistic(pi):
    P = bruhat_poset(len(pi))
    I = P.subposet(P.principal_order_ideal(pi))
    return len(I.maximal_chains())

-----------------------------------------------------------------------------
Statistic values:

[1]         => 1
[1,2]       => 1
[2,1]       => 1
[1,2,3]     => 1
[1,3,2]     => 1
[2,1,3]     => 1
[2,3,1]     => 2
[3,1,2]     => 2
[3,2,1]     => 4
[1,2,3,4]   => 1
[1,2,4,3]   => 1
[1,3,2,4]   => 1
[1,3,4,2]   => 2
[1,4,2,3]   => 2
[1,4,3,2]   => 4
[2,1,3,4]   => 1
[2,1,4,3]   => 2
[2,3,1,4]   => 2
[2,3,4,1]   => 6
[2,4,1,3]   => 6
[2,4,3,1]   => 16
[3,1,2,4]   => 2
[3,1,4,2]   => 6
[3,2,1,4]   => 4
[3,2,4,1]   => 16
[3,4,1,2]   => 20
[3,4,2,1]   => 52
[4,1,2,3]   => 6
[4,1,3,2]   => 16
[4,2,1,3]   => 16
[4,2,3,1]   => 64
[4,3,1,2]   => 52
[4,3,2,1]   => 168
[1,2,3,4,5] => 1
[1,2,3,5,4] => 1
[1,2,4,3,5] => 1
[1,2,4,5,3] => 2
[1,2,5,3,4] => 2
[1,2,5,4,3] => 4
[1,3,2,4,5] => 1
[1,3,2,5,4] => 2
[1,3,4,2,5] => 2
[1,3,4,5,2] => 6
[1,3,5,2,4] => 6
[1,3,5,4,2] => 16
[1,4,2,3,5] => 2
[1,4,2,5,3] => 6
[1,4,3,2,5] => 4
[1,4,3,5,2] => 16
[1,4,5,2,3] => 20
[1,4,5,3,2] => 52
[1,5,2,3,4] => 6
[1,5,2,4,3] => 16
[1,5,3,2,4] => 16
[1,5,3,4,2] => 64
[1,5,4,2,3] => 52
[1,5,4,3,2] => 168
[2,1,3,4,5] => 1
[2,1,3,5,4] => 2
[2,1,4,3,5] => 2
[2,1,4,5,3] => 6
[2,1,5,3,4] => 6
[2,1,5,4,3] => 16
[2,3,1,4,5] => 2
[2,3,1,5,4] => 6
[2,3,4,1,5] => 6
[2,3,4,5,1] => 24
[2,3,5,1,4] => 24
[2,3,5,4,1] => 80
[2,4,1,3,5] => 6
[2,4,1,5,3] => 24
[2,4,3,1,5] => 16
[2,4,3,5,1] => 80
[2,4,5,1,3] => 100
[2,4,5,3,1] => 312
[2,5,1,3,4] => 24
[2,5,1,4,3] => 80
[2,5,3,1,4] => 80
[2,5,3,4,1] => 384
[2,5,4,1,3] => 312
[2,5,4,3,1] => 1176
[3,1,2,4,5] => 2
[3,1,2,5,4] => 6
[3,1,4,2,5] => 6
[3,1,4,5,2] => 24
[3,1,5,2,4] => 24
[3,1,5,4,2] => 80
[3,2,1,4,5] => 4
[3,2,1,5,4] => 16
[3,2,4,1,5] => 16
[3,2,4,5,1] => 80
[3,2,5,1,4] => 80
[3,2,5,4,1] => 320
[3,4,1,2,5] => 20
[3,4,1,5,2] => 100
[3,4,2,1,5] => 52
[3,4,2,5,1] => 312
[3,4,5,1,2] => 464
[3,4,5,2,1] => 1408
[3,5,1,2,4] => 100
[3,5,1,4,2] => 424
[3,5,2,1,4] => 312
[3,5,2,4,1] => 1752
[3,5,4,1,2] => 1680
[3,5,4,2,1] => 6016
[4,1,2,3,5] => 6
[4,1,2,5,3] => 24
[4,1,3,2,5] => 16
[4,1,3,5,2] => 80
[4,1,5,2,3] => 100
[4,1,5,3,2] => 312
[4,2,1,3,5] => 16
[4,2,1,5,3] => 80
[4,2,3,1,5] => 64
[4,2,3,5,1] => 384
[4,2,5,1,3] => 424
[4,2,5,3,1] => 1752
[4,3,1,2,5] => 52
[4,3,1,5,2] => 312
[4,3,2,1,5] => 168
[4,3,2,5,1] => 1176
[4,3,5,1,2] => 1680
[4,3,5,2,1] => 6016
[4,5,1,2,3] => 464
[4,5,1,3,2] => 1680
[4,5,2,1,3] => 1680
[4,5,2,3,1] => 9216
[4,5,3,1,2] => 6720
[4,5,3,2,1] => 27968
[5,1,2,3,4] => 24
[5,1,2,4,3] => 80
[5,1,3,2,4] => 80
[5,1,3,4,2] => 384
[5,1,4,2,3] => 312
[5,1,4,3,2] => 1176
[5,2,1,3,4] => 80
[5,2,1,4,3] => 320
[5,2,3,1,4] => 384
[5,2,3,4,1] => 2176
[5,2,4,1,3] => 1752
[5,2,4,3,1] => 8032
[5,3,1,2,4] => 312
[5,3,1,4,2] => 1752
[5,3,2,1,4] => 1176
[5,3,2,4,1] => 8032
[5,3,4,1,2] => 9216
[5,3,4,2,1] => 37312
[5,4,1,2,3] => 1408
[5,4,1,3,2] => 6016
[5,4,2,1,3] => 6016
[5,4,2,3,1] => 37312
[5,4,3,1,2] => 27968
[5,4,3,2,1] => 130560

-----------------------------------------------------------------------------
Created: Aug 28, 2017 at 11:08 by Christian Stump

-----------------------------------------------------------------------------
Last Updated: Jan 13, 2018 at 12:45 by Martin Rubey