5
$\begingroup$

I am using Mathematica 9. If I input:

NumberOfPermutationsByType[{2, 2, 1, 1}]

Mathematica returns 1/8. I was expecting 45, the number of permutations of {1,2,3,4,5,6} with cycle lengths 2,2,1,1.

$\endgroup$
7
$\begingroup$

The type of a permutation of length $n$ is $\{\lambda_1, \lambda_2, \ldots, \lambda_n\}$ where $\lambda_i$ is the number of cycles of length $i$. Therefore, the number of permutations of $\{1, 2, 3, 4, 5, 6\}$ that have two 1-cycles and two 2-cycles is

NumberOfPermutationsByType[{2, 2, 0, 0, 0, 0}]

(* 45 *)

The best reference for Combinatorica is Steven Skiena's book, in particular section 3.1.2 (page 99) shows the actual implementation of this function:

NumberOfPermutationsByType[l_List] := 
                (Length[l]!)/Apply[Times, Table[l[[i]]!i^(l[[i]]), {i, Length[l]}]]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.