Saturday, February 21, 2026
HomeLanguagesPython | sympy.catalan() method

Python | sympy.catalan() method

With the help of sympy.catalan() method, we can find the Catalan number in SymPy. It is denoted as –

   C_n = \frac{1}{n+1} \binom{2n}{n}

Syntax: catalan(n)

Parameter:
n – It denotes the nth Catalan number.

Returns: Returns the nth Catalan number.

Example #1:




# import sympy 
from sympy import * n = 4
print("Value of n = {}".format(n))
   
# Use sympy.catalan() method 
nth_catalan = catalan(n)  
      
print("Value of nth catalan number : {}".format(nth_catalan))  


Output:

Value of n = 4
Value of nth catalan number : 14

Example #2:




# import sympy 
from sympy import * n = 15
print("Value of n = {}".format(n))
   
# Use sympy.catalan() method 
nth_catalan = catalan(n)  
      
print("Value of nth catalan number : {}".format(nth_catalan))  


Output:

Value of n = 15
Value of nth catalan number : 9694845
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32506 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6882 POSTS0 COMMENTS
Nicole Veronica
12005 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12099 POSTS0 COMMENTS
Shaida Kate Naidoo
7011 POSTS0 COMMENTS
Ted Musemwa
7255 POSTS0 COMMENTS
Thapelo Manthata
6967 POSTS0 COMMENTS
Umr Jansen
6956 POSTS0 COMMENTS