Open In App

Python | sympy.composite() method

Last Updated : 27 Aug, 2019
Summarize
Comments
Improve
Suggest changes
Share
Like Article
Like
Report
With the help of sympy.composite() method, we can find the nth composite number, with the composite number indexed as composite(1) = 4, composite(2) = 6, etc.
Syntax: composite(n) Parameter: n - It denotes the nth composite number. Returns: Returns the nth composite number.
Example #1: Python3
# import sympy 
from sympy import composite

n = 5

# Use composite() method 
nth_composite = composite(n) 
    
print("The {}th composite is {}".format(n, nth_composite))  
Output:
The 5th composite is 10
Example #2: Python3
# import sympy 
from sympy import composite

n = 25

# Use composite() method 
nth_composite = composite(n) 
    
print("The {}th composite is {}".format(n, nth_composite))          
Output:
The 25th composite is 38

Next Article
Article Tags :
Practice Tags :

Similar Reads