Check if a number is power of 8 or not | function to check if power of 8 ; calculate log8 ( n ) ; check if i is an integer or not ; Driver Code
< ? php function checkPowerof8 ( $ n ) { $ i = log ( $ n ) / log ( 8 ) ; return ( $ i - floor ( $ i ) < 0.000001 ) ; } $ n = 65 ; if ( checkPowerof8 ( $ n ) ) echo " Yes " ; else echo " No " ; ? >