Question: 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, write an algorithm
or C program to find the nth number in the series

Solution: Let n=3 ,then number series will be like:
0000111,0001011,0001101,0001110
the whole bunch of 1's will slowly shift towards right and every nth number will be having all 1s together.

Pusedo code:: to find kth no of series.(index from 0)
base=0
shift=k/n;
remain=k%n;// a 0 will be there between remain and (n-remain) no of 1s.

for(i=0;i<(n-remain);i++)
base=base & (1<<(i+shift));
for(i=n-remain;i base=base & (1<<(i+shift+1));