if n is a perfect root , then both its square roots are its factors
if ( a * a == n ) { document . write ( " " + a + " " + a + " " ) ; return ; } let b ; while ( true ) { let b1 = a * a - n ; b = parseInt ( Math . sqrt ( b1 ) , 10 ) ; if ( b * b == b1 ) break ; else a += 1 ; } document . write ( " " + ( a - b ) + " " + ( a + b ) + " " ) ; return ; }