Surd number | Returns true if x is Surd number ; Try all powers of i ; Driver Code
function isSurd ( n ) { for ( let i = 2 ; i * i <= n ; i ++ ) { let j = i ; while ( j < n ) j = j * i ; if ( j == n ) return false ; } return true ; } let n = 15 ; if ( isSurd ( n ) ) document . write ( " " ) ; else document . write ( " " ) ;