第 661 题:(2012 AIME II, 7)
Let $S$ be the increasing sequence of positive integers whose binary representation has exactly $8$ ones. Let $N$ be the 1000th number in $S$. Find the remainder when $N$ is divided by $1000$.
- Numbers with exactly $j$ ones and at most $k$ binary digits: $\binom kj$. Since $\binom{12}8=495<1000\le\binom{13}8=1287$, $N=2^{12}+N_1$ with $N_1$ the $505$th number with $7$ ones.
- $\binom{11}7=330<505\le\binom{12}7=792$, so $N_1=2^{11}+N_2$, $N_2$ the $175$th with $6$ ones. $\binom96=84<175\le\binom{10}6=210$, so $N_2=2^9+N_3$, $N_3$ the $91$st with $5$ ones. $\binom85=56<91\le\binom95=126$, so $N_3=2^8+N_4$, $N_4$ the $35$th with $4$ ones, which is the largest with $7$ digits since $\binom74=35$, so $N_4=1111000_2=120$.
- $N=4096+2048+512+256+120=7032$, remainder $32$. The answer is $\boxed{032}$.
Let $S$ be the increasing sequence of positive integers whose binary representation has exactly $6$ ones. Let $N$ be the 500th number in $S$. Find the remainder when $N$ is divided by $1000$.