14. Let $[x]$ denote the greatest integer not exceeding $x$, e.g. $[\pi]=3,[5.31]=5$ and $[2010]=2010$. Given $f(0)=0$ and $f(n)=f\left(\left[\frac{n}{2}\right]\right)+n-2\left[\frac{n}{2}\right]$ for any positive integer $n$. If $m$ is a positive integer not exceeding 2010, find the greatest possible value of $f(m)$.
(2 marks)
設 $[x]$ 表示不超過 $x$ 的最大整數, 例如： $[\pi]=3 、[5.31]=5 、[2010]=2010$ 。已知 $f(0)=0$, 且對任意正整數 $n$ 皆有 $f(n)=f\left(\left[\frac{n}{2}\right]\right)+n-2\left[\frac{n}{2}\right]$ 。若 $m$ 是不超過 2010 的正整數, 求 $f(m)$ 的最大可能值。
(2 分)
14. 10
14. If the binary representation of $n$ is $\overline{a_{k} a_{k-1} a_{k-2} \cdots a_{2} a_{1}}$, where each $a_{i}$ is 0 or 1 , then we have $\left[\frac{n}{2}\right]=\overline{a_{k} a_{k-1} a_{k-2} \ldots a_{2}}$ and $n-2\left[\frac{n}{2}\right]=a_{1}$. It follows that
$$
\begin{array}{l}
f(n)=f\left(\overline{a_{k} a_{k-1} a_{k-2} \ldots a_{2} a_{1}}\right) \\
=f\left(\overline{a_{k} a_{k-1} a_{k-2} \ldots a_{2}}\right)+a_{1} \\
=f\left(\overline{a_{k} a_{k-1} a_{k-2} \ldots a_{3}}\right)+a_{2}+a_{1} \\
=\cdots \\
=f\left(a_{k}\right)+a_{k-1}+a_{k-2}+\cdots+a_{2}+a_{1} \\
=a_{k}+a_{k-1}+a_{k-2}+\cdots+a_{2}+a_{1} \\
\end{array}
$$
which is number of 1's in the binary representation of $n$. For $0 \leq n \leq 2010$, the binary representation of $n$ has at most 11 digits since $2^{10}2010$ ). Hence the maximum value of $f(n)$ is 10 , as we can check, for instance, that $f(1023)=f\left(2^{10}-1\right)=f\left(1111111111_{2}\right)=10$.