To check if i is a factor of x and the minimum possible number satisfying the given conditions
if ( x % i == 0 && lcm ( i , Math . floor ( x / i ) ) == x ) { ans = i ; } } document . write ( ans + " " + Math . floor ( x / ans ) ) ; }