Find Nth term of the series 1 , 6 , 18 , 40 , 75 , ... . | Function to generate a fixed number ; ( N ^ 2 * ( N + 1 ) ) / 2 ; Driver code
def nthTerm ( N ) : NEW_LINE INDENT nth = 0 NEW_LINE nth = ( N * N * ( N + 1 ) ) // 2 NEW_LINE return nth NEW_LINE DEDENT N = 5 NEW_LINE print ( nthTerm ( N ) ) NEW_LINE