md`
for n = 3287234
* bits: '1100100010100011000010' // n.toString(2)
* lenbits: 22 // bits.length
* setbits: 8 // bits.replace(/0/g,'').length or bits.split('1').slice(1).reverse().length
* ${tex`{22 \choose 14}`}
* diffvec: [1,4,0,3,1,3,2,0] // bits.split('1').slice(1).reverse().map(s => s.length)
* basevec: [1,5,5,8,9,12,14,14] // diffvec.map((e,i,a) => e + a.slice(0,i).reduce((a,b) => a+b,0))
Perhaps a better approach: assume an implied leading 1, treating any leading 0s as an additional difference list element (including 0 leading 0s for representations ending in 1). The first slice(0,-1) elements of the subset summed list should be completely equivalent to the above q-exponent subsets above, where the leading 0s are ignored -- so should equal to q^k where k = list sum - last list element (the number of trailing 0s).
Difference vectors have the useful property of summing to number of 0s in the binary rep.
${tex`
\\ 00000: [5] : [5] : 5
\\ \
\\ 00001: [0,4] : [0,4] : 4
\\ 00010: [1,3] : [1,4] : 5
\\ 00100: [2,2] : [2,4] : 6
\\ 01000: [3,1] : [3,4] : 7
\\ 10000: [4,0] : [4,4] : 8
\\ \
\\ 00011: [0,0,3] : [0,0,3] : 3
\\ 10001: [0,3,0] : [0,3,3] : 6
\\ 11000: [3,0,0] : [3,3,3] : 9
\\ 00110: [1,0,2] : [1,1,3] : 5
\\ 01001: [0,2,1] : [0,2,3] : 5
\\ 10100: [2,1,0] : [2,3,3] : 8
\\ 00101: [0,1,2] : [0,1,3] : 4
\\ 10010: [1,2,0] : [1,3,3] : 7
\\ 01100: [2,0,1] : [2,2,3] : 7
\\ 01010: [1,1,1] : [1,2,3] : 6
\\ \
\\ 00111: [0,0,0,2] : [0,0,0,2] : 2
\\ 10011: [0,0,2,0] : [0,0,2,2] : 4
\\ 11001: [0,2,0,0] : [0,2,2,2] : 6
\\ 11100: [2,0,0,0] : [2,2,2,2] : 8
\\ 01011: [0,0,1,1] : [0,0,1,2] : 3
\\ 10101: [0,1,1,0] : [0,1,2,2] : 5
\\ 11010: [1,1,0,0] : [1,2,2,2] : 7
\\ 01110: [1,0,0,1] : [1,1,1,2] : 5
\\ 01101: [0,1,0,1] : [0,1,1,2] : 4
\\ 10110: [1,0,1,0] : [1,1,2,2] : 6
\\ \
\\ 01111: [0,0,0,0,1] : [0,0,0,0,1] : 1
\\ 10111: [0,0,0,1,0] : [0,0,0,1,1] : 2
\\ 11011: [0,0,1,0,0] : [0,0,1,1,1] : 3
\\ 11101: [0,1,0,0,0] : [0,1,1,1,1] : 4
\\ 11110: [1,0,0,0,0] : [1,1,1,1,1] : 5
\\ \
\\ 11111: [0,0,0,0,0,0] : [0,0,0,0,0,0] : 0
`}
`