Sum of divisors of factorial of a number | function to calculate factorial ; function to calculate sum of divisor ; Returns sum of divisors of n ! ; Driver Code
function fact ( n ) { if ( n == 0 ) return 1 ; return n * fact ( n - 1 ) ; } function div ( x ) { let ans = 0 ; for ( let i = 1 ; i <= x ; i ++ ) if ( x % i == 0 ) ans += i ; return ans ; } function sumFactDiv ( n ) { return div ( fact ( n ) ) ; } let n = 4 ; document . write ( sumFactDiv ( n ) ) ;