human
What is a code to sum of the first N terms of the series 2 , 6 , 12 , 20 , 30 given the following:
Sum of the first N terms of the series 2 , 6 , 12 , 20 , 30. ... | Function to calculate the sum.
number of terms to be included in the sum.
find the Sum"
Solution in Python:
assistant
#Here is code to sum of the first N terms of the series 2 , 6 , 12 , 20 , 30.
 def calculateSum ( n ) :
	return ( n * ( n + 1 ) // 2 + n * ( n + 1 ) * ( 2 * n + 1 ) // 6 )
n = 3
print ( " Sum ▁ = ▁ " , calculateSum ( n ) )