4. A positive integer $x$ is called a magic number if, when $x$ is expressed in binary form, it possesses an even number of ' 1 's. For example, the first five magic numbers are $3,5,6,9$ and 10 . Find, in decimal notation, the sum of the first 2003 magic numbers.
(1 mark)
4. 若正整數 $x$ 以二進制表示時「1」的數目為偶數, 則 $x$ 稱為「魔幻數」。例如, 首五個「魔幻數」為 3、 5、6、9、10。求首 2003 個「魔幻數」之和, 答案以十進制表示。
(1 分)
4. 4015014
4. Let $n$ be a positive integer. Consider the numbers $4 n, 4 n+1,4 n+2$ and $4 n+3$. The last two digits of their binary representations are $00,01,10$ and 11 respectively. Among these, either $4 n$ and $4 n+3$ are magic numbers, or $4 n+1$ and $4 n+2$ are magic numbers. In any case, the sum of the two magic numbers among the four is equal to $8 n+3$. Now the first magic number is $3=4(0)+3$, so the answer is $3+8(1+2+\cdots+1001)+3(1001)=4015014$.