Find n | func for calualtion ; for summation of square of first n - natural nos . ; summation of first n natural nos . ; return result ; Driver Code
def seriesFunc ( n ) : NEW_LINE INDENT sumSquare = ( n * ( n + 1 ) * ( 2 * n + 1 ) ) / 6 NEW_LINE sumNatural = ( n * ( n + 1 ) / 2 ) NEW_LINE return ( sumSquare + sumNatural + 1 ) NEW_LINE DEDENT n = 8 NEW_LINE print ( int ( seriesFunc ( n ) ) ) NEW_LINE n = 13 NEW_LINE print ( int ( seriesFunc ( n ) ) ) NEW_LINE