Friday, October 3, 2025
HomeLanguagesPython | sympy.composite() method

Python | sympy.composite() method

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:




# 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:




# 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
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32331 POSTS0 COMMENTS
Milvus
85 POSTS0 COMMENTS
Nango Kala
6703 POSTS0 COMMENTS
Nicole Veronica
11868 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11929 POSTS0 COMMENTS
Shaida Kate Naidoo
6818 POSTS0 COMMENTS
Ted Musemwa
7080 POSTS0 COMMENTS
Thapelo Manthata
6775 POSTS0 COMMENTS
Umr Jansen
6776 POSTS0 COMMENTS