text: Number of values of b such that a = b + ( a ^ b ) | Javascript program to find the number of values of b such that a = b + ( a ^ b ) ; Function to return the number of solutions ; Driver Code
code: function bitCount ( n ) { let count = 0 ; while ( n != 0 ) { count ++ ; n &= ( n - 1 ) ; } return count ; } function countSolutions ( a ) { let count = bitCount ( a ) ; count = Math . pow ( 2 , count ) ; return count ; } let a = 3 ; document . write ( countSolutions ( a ) ) ;