Find Nth term of series 1 , 4 , 15 , 72 , 420. . . | Function for finding factorial of N ; return factorial of N ; Function for calculating Nth term of series ; Driver code
< ? php function factorial ( $ N ) { $ fact = 1 ; for ( $ i = 1 ; $ i <= $ N ; $ i ++ ) $ fact = $ fact * $ i ; return $ fact ; } function nthTerm ( $ N ) { return ( factorial ( $ N ) * ( $ N + 2 ) / 2 ) ; } $ N = 6 ; echo nthTerm ( $ N ) ; ? >