Please also note that there is an `parity` function in the Permutations 
package that does exactly that:

    julia> using Permutations

    julia> p = Permutations([3,4,5,2,1])
    (1,3,5)(2,4)

    julia> parity(p)
    1

It returns 1 for odd permutations and 0 for even ones, and an error in case 
the vector is not a permutation of [1..n]. It computes the parity/sign by 
adding the length of the cycles.


Reply via email to