Woodall Number | PHP 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
< ? php function isWoodall ( $ x ) { if ( $ x % 2 == 0 ) return false ; if ( $ x == 1 ) return true ; $ x ++ ; $ p = 0 ; while ( $ x % 2 == 0 ) { $ x = $ x / 2 ; $ p ++ ; if ( $ p == $ x ) return true ; } return false ; } $ x = 383 ; if ( isWoodall ( $ x ) ) echo " Yes " ; else echo " No " ; ? >