17. A bag contains 15 balls, marked with the 15 numbers $2^{0}, 2^{1}, 2^{2}, \ldots, 2^{14}$ respectively. Each ball is either red or blue, and there is at least one ball of each colour. Let $a$ be the sum of the numbers on all red balls, $b$ be the sum of the numbers on all blue balls and $d$ be the H.C.F. of $a$ and $b$. Find the greatest possible value of $d$.
一個袋子中有 15 個球，它們分別寫上 $2^{0} 、 2^{1} 、 2^{2} 、 \cdots 、 2^{14}$ 遗 15 個數。每個球都是紅色或藍色的, 而且紅球和藍球均最少各有一個。設 $a$ 爲所有紅球上的各數之和、 $b$ 爲所有藍球上的各數之和、 $d$ 䲸 $a$ 和 $b$ 的最大公因數。求 $d$ 的最大可能值。
17. 4681
17. The sum of the numbers on all balls is $a+b=2^{0}+2^{1}+\cdots+2^{14}=2^{15}-1=32767$. Since both $a$ and $b$ are divisible by $d$, so is $a+b=32767$. It is easy to see that $d$ cannot be equal to 32767 . Since the prime factorisation of 32767 is $7 \times 31 \times 151$, the next largest possible candidate for $d$ is $31 \times 151=4681$. This value of $d$ is attainable; to see this, note that the binary representation of 4681 is 1001001001001 , so that if balls numbered $2^{k}$ are red if $k$ is divisible by 3 and blue if otherwise, then we will have $a=4681, b=4681 \times 6$ and $d=4681$.