Signature of a permutation : signature

### 4.10.12 Signature of a permutation : signature

signature takes as argument a permutation.
signature returns the signature of the permutation given as argument.
The signature of a permutation is equal to :

- 1 if the permutation is equal to an even product of transpositions,
- -1 if the permutation is equal to an odd product of transpositions.

The signature of a cycle of size k is : (−1)k+1.
Input :

signature([3,4,5,2,0,1])

Output :

-1

Indeed permu2cycles([3,4,5,2,0,1])=[[0,3,2,5,1,4]].