Con la ayuda del sympy.combinatorics.partitions.IntegerPartition().prev_lex()
método, podemos obtener la partición anterior del entero n en orden léxico usando el sympy.combinatorics.partitions.IntegerPartition().prev_lex()
método.
Sintaxis:
sympy.combinatorics.partitions.IntegerPartition().prev_lex()
Retorno: Retorna el valor léxico de la partición anterior del entero n.
Ejemplo #1:
En este ejemplo, podemos ver que al usar el sympy.combinatorics.partitions.IntegerPartition().prev_lex()
método, podemos obtener el valor léxico de la partición anterior del entero n.
# import sympy and IntegerPartition from sympy.combinatorics.partitions import IntegerPartition from sympy import * # Using sympy.combinatorics.partitions.IntegerPartition().prev_lex() method gfg = IntegerPartition([1, 2, 3]) print(gfg.prev_lex())
Producción :
[3, 1, 1, 1]
Ejemplo #2:
# import sympy and IntegerPartition from sympy.combinatorics.partitions import IntegerPartition from sympy import * # Using sympy.combinatorics.partitions.IntegerPartition().prev_lex() method gfg = IntegerPartition([1, 2, 3, 4, 3, 2, 1]) print(gfg.prev_lex())
Producción :
[4, 3, 3, 2, 1, 1, 1, 1]
Publicación traducida automáticamente
Artículo escrito por Jitender_1998 y traducido por Barcelona Geeks. The original can be accessed here. Licence: CCBY-SA