*****************************************************************************
*       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: St000506

-----------------------------------------------------------------------------
Collection: Integer partitions

-----------------------------------------------------------------------------
Description: The number of standard desarrangement tableaux of shape equal to the given partition.

A '''standard desarrangement tableau''' is a standard tableau whose first ascent is even. Here, an ascent of a standard tableau is an entry $i$ such that $i+1$ appears to the right or above $i$ in the tableau (with respect to English tableau notation).

This is also the nullity of the random-to-random operator (and the random-to-top) operator acting on the simple module of the symmetric group indexed by the given partition. See also:
* [[St000046]]: The largest eigenvalue of the random to random operator acting on the simple module corresponding to the given partition
* [[St000500]]: Eigenvalues of the random-to-random operator acting on the regular representation.

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

-----------------------------------------------------------------------------
Code:
def tableau_ascents(t):
    r"""
    The (sorted list) of ascents of the standard tableau `t`.

    An *ascent* of a standard tableau `t` is an entry `i`
    such that `i+1` apears to the right or above `i` in `t`
    (in English notation for tableaux).
    """
    locations = {}
    for (i, row) in enumerate(t):
        for (j, entry) in enumerate(row):
            locations[entry] = (i, j)
    ascents = [t.size()]
    for i in range(1, t.size()):
        # ascent means i+1 appears to the right or above
        x, _ = locations[i]
        u, _ = locations[i+1]
        if u <= x:
            ascents.append(i)
    return sorted(ascents)

def is_desarrangement_tableau(t):
    r"""
    Test whether a tableau is a desarrangement tableau.

    A *desarrangement tableau* is a standard tableau
    whose first ascent is even.
    """
    return min(tableau_ascents(Tableau(t))) % 2 == 0

def statistic(la):
    return len([t for t in StandardTableaux(la) if is_desarrangement_tableau(t)])


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

[1]                       => 0
[2]                       => 0
[1,1]                     => 1
[3]                       => 0
[2,1]                     => 1
[1,1,1]                   => 0
[4]                       => 0
[3,1]                     => 1
[2,2]                     => 1
[2,1,1]                   => 1
[1,1,1,1]                 => 1
[5]                       => 0
[4,1]                     => 1
[3,2]                     => 2
[3,1,1]                   => 2
[2,2,1]                   => 2
[2,1,1,1]                 => 2
[1,1,1,1,1]               => 0
[6]                       => 0
[5,1]                     => 1
[4,2]                     => 3
[4,1,1]                   => 3
[3,3]                     => 2
[3,2,1]                   => 6
[3,1,1,1]                 => 4
[2,2,2]                   => 2
[2,2,1,1]                 => 4
[2,1,1,1,1]               => 2
[1,1,1,1,1,1]             => 1
[7]                       => 0
[6,1]                     => 1
[5,2]                     => 4
[5,1,1]                   => 4
[4,3]                     => 5
[4,2,1]                   => 12
[4,1,1,1]                 => 7
[3,3,1]                   => 8
[3,2,2]                   => 8
[3,2,1,1]                 => 14
[3,1,1,1,1]               => 6
[2,2,2,1]                 => 6
[2,2,1,1,1]               => 6
[2,1,1,1,1,1]             => 3
[1,1,1,1,1,1,1]           => 0
[8]                       => 0
[7,1]                     => 1
[6,2]                     => 5
[6,1,1]                   => 5
[5,3]                     => 9
[5,2,1]                   => 20
[5,1,1,1]                 => 11
[4,4]                     => 5
[4,3,1]                   => 25
[4,2,2]                   => 20
[4,2,1,1]                 => 33
[4,1,1,1,1]               => 13
[3,3,2]                   => 16
[3,3,1,1]                 => 22
[3,2,2,1]                 => 28
[3,2,1,1,1]               => 26
[3,1,1,1,1,1]             => 9
[2,2,2,2]                 => 6
[2,2,2,1,1]               => 12
[2,2,1,1,1,1]             => 9
[2,1,1,1,1,1,1]           => 3
[1,1,1,1,1,1,1,1]         => 1
[9]                       => 0
[8,1]                     => 1
[7,2]                     => 6
[7,1,1]                   => 6
[6,3]                     => 14
[6,2,1]                   => 30
[6,1,1,1]                 => 16
[5,4]                     => 14
[5,3,1]                   => 54
[5,2,2]                   => 40
[5,2,1,1]                 => 64
[5,1,1,1,1]               => 24
[4,4,1]                   => 30
[4,3,2]                   => 61
[4,3,1,1]                 => 80
[4,2,2,1]                 => 81
[4,2,1,1,1]               => 72
[4,1,1,1,1,1]             => 22
[3,3,3]                   => 16
[3,3,2,1]                 => 66
[3,3,1,1,1]               => 48
[3,2,2,2]                 => 34
[3,2,2,1,1]               => 66
[3,2,1,1,1,1]             => 44
[3,1,1,1,1,1,1]           => 12
[2,2,2,2,1]               => 18
[2,2,2,1,1,1]             => 21
[2,2,1,1,1,1,1]           => 12
[2,1,1,1,1,1,1,1]         => 4
[1,1,1,1,1,1,1,1,1]       => 0
[10]                      => 0
[9,1]                     => 1
[8,2]                     => 7
[8,1,1]                   => 7
[7,3]                     => 20
[7,2,1]                   => 42
[7,1,1,1]                 => 22
[6,4]                     => 28
[6,3,1]                   => 98
[6,2,2]                   => 70
[6,2,1,1]                 => 110
[6,1,1,1,1]               => 40
[5,5]                     => 14
[5,4,1]                   => 98
[5,3,2]                   => 155
[5,3,1,1]                 => 198
[5,2,2,1]                 => 185
[5,2,1,1,1]               => 160
[5,1,1,1,1,1]             => 46
[4,4,2]                   => 91
[4,4,1,1]                 => 110
[4,3,3]                   => 77
[4,3,2,1]                 => 288
[4,3,1,1,1]               => 200
[4,2,2,2]                 => 115
[4,2,2,1,1]               => 219
[4,2,1,1,1,1]             => 138
[4,1,1,1,1,1,1]           => 34
[3,3,3,1]                 => 82
[3,3,2,2]                 => 100
[3,3,2,1,1]               => 180
[3,3,1,1,1,1]             => 92
[3,2,2,2,1]               => 118
[3,2,2,1,1,1]             => 131
[3,2,1,1,1,1,1]           => 68
[3,1,1,1,1,1,1,1]         => 16
[2,2,2,2,2]               => 18
[2,2,2,2,1,1]             => 39
[2,2,2,1,1,1,1]           => 33
[2,2,1,1,1,1,1,1]         => 16
[2,1,1,1,1,1,1,1,1]       => 4
[1,1,1,1,1,1,1,1,1,1]     => 1
[11]                      => 0
[10,1]                    => 1
[9,2]                     => 8
[9,1,1]                   => 8
[8,3]                     => 27
[8,2,1]                   => 56
[8,1,1,1]                 => 29
[7,4]                     => 48
[7,3,1]                   => 160
[7,2,2]                   => 112
[7,2,1,1]                 => 174
[7,1,1,1,1]               => 62
[6,5]                     => 42
[6,4,1]                   => 224
[6,3,2]                   => 323
[6,3,1,1]                 => 406
[6,2,2,1]                 => 365
[6,2,1,1,1]               => 310
[6,1,1,1,1,1]             => 86
[5,5,1]                   => 112
[5,4,2]                   => 344
[5,4,1,1]                 => 406
[5,3,3]                   => 232
[5,3,2,1]                 => 826
[5,3,1,1,1]               => 558
[5,2,2,2]                 => 300
[5,2,2,1,1]               => 564
[5,2,1,1,1,1]             => 344
[5,1,1,1,1,1,1]           => 80
[4,4,3]                   => 168
[4,4,2,1]                 => 489
[4,4,1,1,1]               => 310
[4,3,3,1]                 => 447
[4,3,2,2]                 => 503
[4,3,2,1,1]               => 887
[4,3,1,1,1,1]             => 430
[4,2,2,2,1]               => 452
[4,2,2,1,1,1]             => 488
[4,2,1,1,1,1,1]           => 240
[4,1,1,1,1,1,1,1]         => 50
[3,3,3,2]                 => 182
[3,3,3,1,1]               => 262
[3,3,2,2,1]               => 398
[3,3,2,1,1,1]             => 403
[3,3,1,1,1,1,1]           => 160
[3,2,2,2,2]               => 136
[3,2,2,2,1,1]             => 288
[3,2,2,1,1,1,1]           => 232
[3,2,1,1,1,1,1,1]         => 100
[3,1,1,1,1,1,1,1,1]       => 20
[2,2,2,2,2,1]             => 57
[2,2,2,2,1,1,1]           => 72
[2,2,2,1,1,1,1,1]         => 49
[2,2,1,1,1,1,1,1,1]       => 20
[2,1,1,1,1,1,1,1,1,1]     => 5
[1,1,1,1,1,1,1,1,1,1,1]   => 0
[12]                      => 0
[11,1]                    => 1
[10,2]                    => 9
[10,1,1]                  => 9
[9,3]                     => 35
[9,2,1]                   => 72
[9,1,1,1]                 => 37
[8,4]                     => 75
[8,3,1]                   => 243
[8,2,2]                   => 168
[8,2,1,1]                 => 259
[8,1,1,1,1]               => 91
[7,5]                     => 90
[7,4,1]                   => 432
[7,3,2]                   => 595
[7,3,1,1]                 => 740
[7,2,2,1]                 => 651
[7,2,1,1,1]               => 546
[7,1,1,1,1,1]             => 148
[6,6]                     => 42
[6,5,1]                   => 378
[6,4,2]                   => 891
[6,4,1,1]                 => 1036
[6,3,3]                   => 555
[6,3,2,1]                 => 1920
[6,3,1,1,1]               => 1274
[6,2,2,2]                 => 665
[6,2,2,1,1]               => 1239
[6,2,1,1,1,1]             => 740
[6,1,1,1,1,1,1]           => 166
[5,5,2]                   => 456
[5,5,1,1]                 => 518
[5,4,3]                   => 744
[5,4,2,1]                 => 2065
[5,4,1,1,1]               => 1274
[5,3,3,1]                 => 1505
[5,3,2,2]                 => 1629
[5,3,2,1,1]               => 2835
[5,3,1,1,1,1]             => 1332
[5,2,2,2,1]               => 1316
[5,2,2,1,1,1]             => 1396
[5,2,1,1,1,1,1]           => 664
[5,1,1,1,1,1,1,1]         => 130
[4,4,4]                   => 168
[4,4,3,1]                 => 1104
[4,4,2,2]                 => 992
[4,4,2,1,1]               => 1686
[4,4,1,1,1,1]             => 740
[4,3,3,2]                 => 1132
[4,3,3,1,1]               => 1596
[4,3,2,2,1]               => 2240
[4,3,2,1,1,1]             => 2208
[4,3,1,1,1,1,1]           => 830
[4,2,2,2,2]               => 588
[4,2,2,2,1,1]             => 1228
[4,2,2,1,1,1,1]           => 960
[4,2,1,1,1,1,1,1]         => 390
[4,1,1,1,1,1,1,1,1]       => 70
[3,3,3,3]                 => 182
[3,3,3,2,1]               => 842
[3,3,3,1,1,1]             => 665
[3,3,2,2,2]               => 534
[3,3,2,2,1,1]             => 1089
[3,3,2,1,1,1,1]           => 795
[3,3,1,1,1,1,1,1]         => 260
[3,2,2,2,2,1]             => 481
[3,2,2,2,1,1,1]           => 592
[3,2,2,1,1,1,1,1]         => 381
[3,2,1,1,1,1,1,1,1]       => 140
[3,1,1,1,1,1,1,1,1,1]     => 25
[2,2,2,2,2,2]             => 57
[2,2,2,2,2,1,1]           => 129
[2,2,2,2,1,1,1,1]         => 121
[2,2,2,1,1,1,1,1,1]       => 69
[2,2,1,1,1,1,1,1,1,1]     => 25
[2,1,1,1,1,1,1,1,1,1,1]   => 5
[1,1,1,1,1,1,1,1,1,1,1,1] => 1

-----------------------------------------------------------------------------
Created: May 24, 2016 at 23:10 by Franco Saliola

-----------------------------------------------------------------------------
Last Updated: Jun 11, 2016 at 01:03 by Martin Rubey