Find the first natural number whose factorial is divisible by x | Returns first number whose factorial divides x . ; var i = 1 ; Result ; Driver code
function firstFactorialDivisibleNumber ( x ) { var fact = 1 ; for ( i = 1 ; i < x ; i ++ ) { fact = fact * i ; if ( fact % x == 0 ) break ; } return i ; } var x = 16 ; document . write ( firstFactorialDivisibleNumber ( x ) ) ;