Python中的SymPy Partition.prev_lex()
Partition.prev_lex() : prev_lex()是一个Sympy Python库函数,用于返回前一个整数分区,n的列序。如果分区是[1,…,1],这个排序就会环绕[n]。
语法 : sympy.combinatorics.partitions.Partition.prev_lex()
返回:之前的整数分区,n为lexicographical顺序。
代码#1:prev_lex()示例
输出 :
p : [312, 121, 14, 5]
Previous Integer : [312, 121, 14, 4, 1]
代码#2:prev_lex()示例
输出 :
p : [312, 121, 56, 34, 32, 14, 1]
Previous Integer : [312, 121, 56, 34, 32, 13, 2]