4. Let $f(x)=a x+b$ where $a$ and $b$ are integers. If $f(f(0))=0$ and $f(f(f(4)))=9$, find the value of $f(f(f(f(1))))+f(f(f(f(2))))+\cdots+f(f(f(f(2014))))$.
(1 mark)
設 $f(x)=a x+b$, 其中 $a 、 b$ 為整數。若 $f(f(0))=0$ 而 $f(f(f(4)))=9$, 求 $f(f(f(f(1))))+f(f(f(f(2))))+\cdots+f(f(f(f(2014)))$ 的值。
4. 2029105
4. From $0=f(f(0))=f(b)=a b+b=(a+1) b$, we get $a=-1$ or $b=0$.
If $b=0$, i.e. $f(x)=a x$, then we have $9=f(f(f(4)))=f(f(4 a))=f\left(4 a^{2}\right)=4 a^{3}$, which has no solution as $a$ is an integer.
Hence we must have $a=-1$. Then $f(x)=-x+b$ and hence $f(f(x))=-(-x+b)+b=x$. It follows that $f(f(f(f(x))))=f(f(x))=x$ for all $x$ and thus the answer is
$$
1+2+\cdots+2014=\frac{2014 \times 2015}{2}=2029105 \text {. }
$$