Max Alekseyev on Mon, 21 Oct 2024 17:01:44 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: number of permutations with a given cycle structure


Also, any integer partition p can be treated as a size type of the set partitions of [n]. The number of the set partitions of a given type p equals
n! / vecprod(apply(x->x!,p)) / vecprod(apply(x->x!,a)),
where a is the vector of multiplicities ("exponents") of 1,2,...,n in p.

Similarly, how numbers of permutations of fixed cycle types form a partition of Stirling numbers of the first kind, the numbers of set partitions of fixed size type form a partition of Stirling numbers of second kind.

Long story short, it would be nice to have this function handy in PARI as well.

Thanks,
Max



On Sat, Oct 19, 2024 at 10:08 AM Max Alekseyev <maxale@gmail.com> wrote:
Hello,

Any integer partition p of n can be treated as a cycle type of the permutations of n, and the number of those permutations is a fundamental function of p that would be nice to have handy in PARI.
Just in case, an explicit formula for this function can be seen in https://en.wikipedia.org/wiki/Permutation#Cycle_type
I was not able to find it in PARI, and if it's indeed missing, could you please add it?

On a related note, I'd appreciate it if this function is not restricted to t_VECSMALL type, but can also accept t_VEC.
I already see trouble with that in permcycles() when a permutation is manually constructed as t_VEC. Btw, can permcycles() be made to accept t_VEC as well?

Thanks,
Max