9. The function $f(n)$ is defined for all positive integer $n$ and take on non-negative integer values such that $f(2)=0, f(3)>0$ and $f(9999)=3333$. Also, for all $m, n$,
$$
f(m+n)-f(m)-f(n)=0 \quad \text { or } \quad 1 .
$$

Determine $f(2005)$.
9. Ans: 668
The given relation implies that
$$
f(m+n) \geq f(m)+f(n) .
$$

Putting $m=n=1$ we obtain $f(2) \geq 2 f(1)$. Since $f(2)=0$ and $f(1)$ is nonnegative, $f(1)=0$. Next, since
$$
f(3)=f(2+1)=f(2)+f(1)+\{0 \text { or } 1\}=\left\{\begin{array}{ll}
0 & \text { or } 1
\end{array}\right\},
$$
where $f(3)>0$, it follows that $f(3)=1$. Now, it can be proved inductively that $f(3 n) \geq n$ for all $n$. Also, if $f(3 n)>n$ for some $n$, then $f(3 m)>m$ for all $m \geq n$. So since $f(3 \times 3333)=f(9999)=3333$, it follows that $f(3 n)=n$ for $n \leq 3333$. In particular $f(3 \times 2005)=2005$. Consequently,
$$
\begin{aligned}
2005 & =f(3 \times 2005) \\
& \geq f(2 \times 2005)+f(2005) \\
& \geq 3 f(2005)
\end{aligned}
$$
and so $f(2005) \leq 2005 / 3<669$. On the other hand,
$$
f(2005) \geq f(2004)+f(1)=f(5 \times 668)=668 .
$$

Therefore $f(2005)=668$.