I would like to find a formula which gives me all binary numbers which contain the digit "1" a certain number of times. For example to times as in this sequence:
I only found a formular with two occurences of the digit:
a(n) = b^i + b^j, where i = floor((sqrt(8*n - 1) + 1)/2) j = n - 1 - i*(i - 1)/2 b=2 for decimal representation b=10 for dual representation
But I'd like to be able to specify any number of occurences, for example three:
111, 1011, 1101, 1110, 10011, 10101, 10110, 11001, ...
Unfortunately, this page didn't provide any hint to its formula: http://oeis.org/A038445
Does anybody know the formula?