There is a sequence of increasing numbers that have the same number of binary 1s in them. Given n (the number of 1 bits set in each number in the series) write an algorithm or C program to find the n'th number in the series.
I found this question on internet and I think the answer is just (((1 << (n+1)) - 1) & ~2). Isn't that right? I found some scary programs to compute the answer.