Find n | func for calualtion ; for summation of square of first n - natural nos . ; summation of first n natural nos . ; return result ; Driver Code
< ? php function seriesFunc ( $ n ) { $ sumSquare = ( $ n * ( $ n + 1 ) * ( 2 * $ n + 1 ) ) / 6 ; $ sumNatural = ( $ n * ( $ n + 1 ) / 2 ) ; return ( $ sumSquare + $ sumNatural + 1 ) ; } $ n = 8 ; echo ( seriesFunc ( $ n ) . " " ) ; $ n = 13 ; echo ( seriesFunc ( $ n ) . " " ) ; ? >