I have binary numbers of length s. They are ordered by numbers of ones, and they can have at most j zeros.
That is: first are ordered all numbers containing (s; 0) possible subsets of s numbers, next are all numbers containing (s; 1) possible subsets of s numbers.....last are all (s; j) possible subsets of s numbers.
(s; j) is binomial coefficient s!/(j!(s-j)!)
For s = 4 and j = 2, problem looks like this: 1111 1110 1101 1011 0111 1100 1010 0110 1001 0101 0011
Problem: how can I given the binary representation get the position? 1111 should give me position 0, 1110 should be assigned with position 1, and so on.
Please, I would appreciate any kind of help. Thank you!