Find Nth term of series 1 , 4 , 15 , 72 , 420. . . | Function to find factorial of N with recursion ; base condition ; use recursion ; calculate Nth term of series ; Driver Code
< ? php function factorial ( $ N ) { if ( $ N == 0 or $ N == 1 ) return 1 ; return $ N * factorial ( $ N - 1 ) ; } function nthTerm ( $ N ) { return ( factorial ( $ N ) * ( $ N + 2 ) / 2 ) ; } $ N = 6 ; echo nthTerm ( $ N ) ; ? >