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

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

-----------------------------------------------------------------------------
Description: The number of permutations whose cube equals a fixed permutation of given cycle type.

For example, the permutation $\pi=412365$ has cycle type $(4,2)$ and $234165$ is the unique permutation whose cube is $\pi$.

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

-----------------------------------------------------------------------------
Code:
@cached_function
def statistic_dict(n, k):
    d = {}
    for pi in Permutations(n):
        sigma = pi^k
        d[sigma] = d.get(sigma, 0) + 1
    return d

def statistic(la):
    n = la.size()
    d = statistic_dict(n, 3)
    sigma = standard_permutation(la)
    return d.get(sigma, 0)


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

[1]                 => 1
[2]                 => 1
[1,1]               => 1
[3]                 => 0
[2,1]               => 1
[1,1,1]             => 3
[4]                 => 1
[3,1]               => 0
[2,2]               => 1
[2,1,1]             => 1
[1,1,1,1]           => 9
[5]                 => 1
[4,1]               => 1
[3,2]               => 0
[3,1,1]             => 0
[2,2,1]             => 1
[2,1,1,1]           => 3
[1,1,1,1,1]         => 21
[6]                 => 0
[5,1]               => 1
[4,2]               => 1
[4,1,1]             => 1
[3,3]               => 0
[3,2,1]             => 0
[3,1,1,1]           => 0
[2,2,2]             => 9
[2,2,1,1]           => 1
[2,1,1,1,1]         => 9
[1,1,1,1,1,1]       => 81
[7]                 => 1
[6,1]               => 0
[5,2]               => 1
[5,1,1]             => 1
[4,3]               => 0
[4,2,1]             => 1
[4,1,1,1]           => 3
[3,3,1]             => 0
[3,2,2]             => 0
[3,2,1,1]           => 0
[3,1,1,1,1]         => 0
[2,2,2,1]           => 9
[2,2,1,1,1]         => 3
[2,1,1,1,1,1]       => 21
[1,1,1,1,1,1,1]     => 351
[8]                 => 1
[7,1]               => 1
[6,2]               => 0
[6,1,1]             => 0
[5,3]               => 0
[5,2,1]             => 1
[5,1,1,1]           => 3
[4,4]               => 1
[4,3,1]             => 0
[4,2,2]             => 1
[4,2,1,1]           => 1
[4,1,1,1,1]         => 9
[3,3,2]             => 0
[3,3,1,1]           => 0
[3,2,2,1]           => 0
[3,2,1,1,1]         => 0
[3,1,1,1,1,1]       => 0
[2,2,2,2]           => 33
[2,2,2,1,1]         => 9
[2,2,1,1,1,1]       => 9
[2,1,1,1,1,1,1]     => 81
[1,1,1,1,1,1,1,1]   => 1233
[9]                 => 0
[8,1]               => 1
[7,2]               => 1
[7,1,1]             => 1
[6,3]               => 0
[6,2,1]             => 0
[6,1,1,1]           => 0
[5,4]               => 1
[5,3,1]             => 0
[5,2,2]             => 1
[5,2,1,1]           => 1
[5,1,1,1,1]         => 9
[4,4,1]             => 1
[4,3,2]             => 0
[4,3,1,1]           => 0
[4,2,2,1]           => 1
[4,2,1,1,1]         => 3
[4,1,1,1,1,1]       => 21
[3,3,3]             => 18
[3,3,2,1]           => 0
[3,3,1,1,1]         => 0
[3,2,2,2]           => 0
[3,2,2,1,1]         => 0
[3,2,1,1,1,1]       => 0
[3,1,1,1,1,1,1]     => 0
[2,2,2,2,1]         => 33
[2,2,2,1,1,1]       => 27
[2,2,1,1,1,1,1]     => 21
[2,1,1,1,1,1,1,1]   => 351
[1,1,1,1,1,1,1,1,1] => 5769

-----------------------------------------------------------------------------
Created: Mar 15, 2019 at 20:50 by Martin Rubey

-----------------------------------------------------------------------------
Last Updated: Mar 15, 2019 at 20:50 by Martin Rubey