(self, size, rank)
return _af_new(perm_array)
Lexicographic permutation unranking.

        Examples
        ========

        >>> from sympy.combinatorics.permutations import Permutation
        >>> Permutation.print_cyclic = False
        >>> a = Permutation.unrank_lex(5, 10)
        >>> a.rank()
        10
        >>> a
        Permutation([0, 2, 4, 1, 3])

        See Also
        ========

        rank, next_lex
Lexicographic permutation unranking.
Lexicographic permutation unranking .
def unrank_lex(self, size, rank):
        """
        Lexicographic permutation unranking.

        Examples
        ========

        >>> from sympy.combinatorics.permutations import Permutation
        >>> Permutation.print_cyclic = False
        >>> a = Permutation.unrank_lex(5, 10)
        >>> a.rank()
        10
        >>> a
        Permutation([0, 2, 4, 1, 3])

        See Also
        ========

        rank, next_lex
        """
        perm_array = [0] * size
        psize = 1
        for i in range(size):
            new_psize = psize*(i + 1)
            d = (rank % new_psize) // psize
            rank -= d*psize
            perm_array[size - i - 1] = d
            for j in range(size - i, size):
                if perm_array[j] > d - 1:
                    perm_array[j] += 1
            psize = new_psize
        return _af_new(perm_array)
def unrank_lex ( self , size , rank ) : perm_array = [ 0 ] * size psize = 1 for i in range ( size ) : new_psize = psize * ( i + 1 ) d = ( rank % new_psize ) // psize rank -= d * psize perm_array [ size - i - 1 ] = d for j in range ( size - i , size ) : if perm_array [ j ] > d - 1 : perm_array [ j ] += 1 psize = new_psize return _af_new ( perm_array )