Count ways to represent N as XOR of distinct integers not exceeding N | Function to count number of ways to represent N as the Bitwise XOR of distinct integers ; Count number of subsets using above - mentioned formula ; Print the resultant count ; Driver Code
function countXorPartition ( N ) { let a = Math . pow ( 2 , Math . floor ( N - Math . log ( N + 1 ) / Math . log ( 2 ) ) ) ; document . write ( a ) ; } let N = 5 ; countXorPartition ( N ) ;