For non-negative integers $x$, the function $f(x)$ is defined as follows:
$$f(0)=0, f(x)=f\left(\left[\frac{x}{10}\right]\right)+\left[\lg \frac{10}{x-10\left[\frac{x-1}{10}\right]}\right]$$
What is the value of $x$ when $f(x)$ reaches its maximum in the range $0 \leqslant x \leqslant 2006$?