📜  Python| sympy.composite() 方法

📅  最后修改于: 2022-05-13 01:55:07.056000             🧑  作者: Mango

Python| sympy.composite() 方法

sympy.composite()方法的帮助下,我们可以找到第n 个合数,该合数索引为Composite(1) = 4、composite(2) = 6等。

示例 #1:

# import sympy 
from sympy import composite
  
n = 5
  
# Use composite() method 
nth_composite = composite(n) 
      
print("The {}th composite is {}".format(n, nth_composite))  

输出:

The 5th composite is 10

示例 #2:

# import sympy 
from sympy import composite
  
n = 25
  
# Use composite() method 
nth_composite = composite(n) 
      
print("The {}th composite is {}".format(n, nth_composite))          

输出:

The 25th composite is 38