Woodall Number | Javascript program to check if a number is Woodball or not . ; If number is even , return false . ; If x is 1 , return true . ; Add 1 to make x even ; While x is divisible by 2 ; Divide x by 2 ; Count the power ; If at any point power and x became equal , return true . ; Driver Code
function isWoodall ( x ) { if ( x % 2 == 0 ) return false ; if ( x == 1 ) return true ; x ++ ; let p = 0 ; while ( x % 2 == 0 ) { x = x / 2 ; p ++ ; if ( p == x ) return true ; } return false ; } let x = 383 ; if ( isWoodall ( x ) ) document . write ( " " ) ; else document . write ( " " ) ;