human
Solving f ( n ) = ( 1 ) + ( 2 * 3 ) + ( 4 * 5 * 6 ) . . . n using Recursion | Recursive function for finding sum of series calculated - number of terms till which sum of terms has been calculated current - number of terms for which sum has to be calculated N - Number of terms in the function to be calculated.
checking termination condition.
product of terms till current.
recursive call for adding terms next in the series.
input number of terms in the series.
invoking the function to calculate the sum"
How can the above be solved in Python?
assistant
#Here is code to solving f ( n ) = ( 1 ) + ( 2 * 3 ) + ( 4 * 5 * 6 ) .
 def seriesSum ( calculated , current , N ) :
	i = calculated ;
	cur = 1 ;
	if ( current == N + 1 ) :
		return 0 ;
	while ( i < calculated + current ) :
		cur *= i ;
		i += 1 ;
	return cur + seriesSum ( i , current + 1 , N ) ;
N = 5 ;
print ( seriesSum ( 1 , 1 , N ) ) ;