d lie on its right hand side.

        The inversion vector is the same as the Lehmer encoding of a
        permutation.

        Examples
        ========

        >>> from sympy.combinatorics.permutations import Permutation
        >>> p = Permutation([4, 8, 0, 7, 1, 5, 3, 6, 2])
        >>> p.inversion_vector()
        [4, 7, 0, 5, 0, 2, 1, 1]
        >>> p = Permutation([3, 2, 1, 0])
        >>> p.inversion_vector()
        [3, 2, 1]

        The inversion vector increases lexicographically with the rank
        of the permutation, the -ith element cycling through 0..i.

        >>> p = Permutation(2)
        >>> while p:
        ...     print('%s %s %s' % (p, p.inversion_vector(), p.rank()))
        ...     p = p.next_lex()
        ...
        Permutation([0, 1, 2]) [0, 0] 0
        Permutation([0, 2, 1]) [0, 1] 1
        Permutation([1, 0, 2]) [1, 0] 2
        Permutation([1, 2, 0]) [1, 1] 3
        Permutation([2, 0, 1]) [2, 0] 4
        Permutation([2, 1, 0]) [2, 1] 5

        See Also
        ========
        from_inversion_vector
        r