Find the sum of series 3 , 7 , 13 , 21 , 31. ... | Function to calculate sum ; returning the final sum ; Driver Code number of terms to find the sum
function calculateSum ( n ) { return ( n * ( parseInt ( Math . pow ( n , 2 ) + 3 * n + 5 ) ) / 3 ) ; } var n = 25 ; document . write ( calculateSum ( n ) ) ;