Skip to content

Esta página también está en español.

Léela en español

このページは日本語でも読めます。

日本語で読む

本页也有简体中文版本。

阅读简体中文版本

permutation_sign function

The sign of a permutation: 1 when it is even, -1 when odd.

How to write it

permutation_sign(p)

p
A permutation, written as the list of where 1, 2, 3 and so on go. Takes a list.

Examples

  • permutation_sign⁡([2,1,3])=−1\displaystyle \operatorname{permutation\_sign}(\left[ 2, 1, 3 \right]) = -1
    permutation_sign([2, 1, 3])

    In the solver, permutation_sign([2, 1, 3]) gives -1.

    Open in the solver