Sum of series 1 * 1 * 2 ! + 2 * 2 * 3 ! + …… . . + n * n * ( n + 1 ) ! | PHP program to find sum of the series . ; Function to calculate required series ; Driver code
< ? php function factorial ( $ n ) { $ res = 1 ; for ( $ i = 2 ; $ i <= $ n ; $ i ++ ) $ res = $ res * $ i ; return $ res ; } function calculateSeries ( $ n ) { return 2 + ( $ n * $ n + $ n - 2 ) * factorial ( $ n + 1 ) ; } $ n = 3 ; echo calculateSeries ( $ n ) ; ? >