Check if a given number N has at least one odd divisor not exceeding N | Function to check whether N has at least one odd divisor not exceeding N - 1 or not ; Stores the value of N ; Reduce the given number N by dividing it by 2 ; If N is divisible by an odd divisor i ; Check if N is an odd divisor after reducing N by dividing it by 2 ; Otherwise ; Driver Code ; Function Call
function oddDivisor ( N ) { var X = N ; var i ; while ( N % 2 == 0 ) { N /= 2 ; } for ( i = 3 ; i * i <= X ; i += 2 ) { if ( N % i == 0 ) { return " " ; } } if ( N != X ) return " " ; return " " ; } var N = 10 ; document . write ( oddDivisor ( N ) ) ;