Did I find the right examples for you? yes no

All Samples(4)  |  Call(4)  |  Derive(0)  |  Import(0)
Returns the index of a permutation.

The index of a permutation is the sum of all subscripts j such
that p[j] is greater than p[j+1].

Examples
========

>>> from sympy.combinatorics.permutations import Permutation
>>> p = Permutation([3, 0, 2, 1, 4])(more...)

src/s/y/sympy-0.7.5/sympy/combinatorics/tests/test_permutations.py   sympy(Download)
    assert r.runs() == [[3], [2], [1], [0]]
 
    assert p.index() == 8
    assert q.index() == 8
    assert r.index() == 3

src/s/y/sympy-HEAD/sympy/combinatorics/tests/test_permutations.py   sympy(Download)
    assert r.runs() == [[3], [2], [1], [0]]
 
    assert p.index() == 8
    assert q.index() == 8
    assert r.index() == 3