Sign

Working with numbers? See sign (arithmetic)

Returns the sign or parity of a permutation. It can be defined as the parity of pairs of elements such that and . Thus, the sign is +1 is is even or -1 if it is odd. Alternatively, the sign of a permutation can be defined from its decomposition into the product of transpositions as , where is the number of transpositions in the decomposition (although such decomposition is not unique, the parity is an invariant).

sign(Permutation)

Given a permutation, returns its sign.