Minimum numbers needed to express every integer below N as a sum | function to count length of binary expression of n ; Driver code
< ? php function countBits ( $ n ) { $ count = 0 ; while ( $ n ) { $ count ++ ; $ n >>= 1 ; } return $ count ; } $ n = 32 ; echo " Minimum ▁ value ▁ of ▁ K ▁ is ▁ = ▁ " , countBits ( $ n ) , " STRNEWLINE " ; ? >