human
Program for nth Fuss – Catalan Number | Returns value of Binomial Coefficient C ( n , k ).
Since C ( n , k ) = C ( n , n - k ).
Calculate value of [ n * ( n - 1 ) * -- - * ( n - k + 1 ) ] / [ k * ( k - 1 ) * -- - * 1 ].
A Binomial coefficient based function to find nth FussCatalan number in O ( n ) time.
Calculate value of 3 nCn.
return 3 nCn / ( 2 n + 1 ).
Driver code"
How can the above be solved in Python?
 ... Give me a code to program for nth Fuss – Catalan Number and the other steps required?
assistant
#Here is code to program for nth Fuss – Catalan Number and the other steps required.
 def binomialCoeff ( n , k ) :
	res = 1 ;
	if ( k > n - k ) :
		k = n - k ;
	for i in range ( k ) :
		res *= ( n - i ) ;
		res //= ( i + 1 ) ;
	return res ;
def Fuss_catalan ( n ) :
	c = binomialCoeff ( 3 * n , n ) ;
	return c // ( 2 * n + 1 ) ;
if __name__ == " _ _ main _ _ " :
	for i in range ( 10 ) :
		print ( Fuss_catalan ( i ) , end = " ▁ " ) ;