Example 1 For any positive integer $n$, connect the origin $O$ and the point $A_{n}(n, n+3)$. Let $f(n)$ denote the number of lattice points on the line segment $O A_{n}$ except for the endpoints, find $f(1)+f(2)+\cdots+f(2006)$.
The equation of the line segment $O A_{n}$ is $y=\frac{n+3}{n} x(0 \leqslant x \leqslant n)$, then $f(n)$ is the number of integer solutions of the equation $y=\frac{n+3}{n} x$ within $(0, n)$.
We can divide the lattice point $A_{n}$ into two categories: the first category consists of lattice points where the horizontal and vertical coordinates are coprime, and the second category consists of lattice points where the horizontal and vertical coordinates are not coprime. When $A_{n}$ is a lattice point of the first category, $(n, n+3)=1$, then the equation $y=\frac{n+3}{n} x$ has no integer solutions within $(0, n)$; when $A_{n}$ is a lattice point of the second category, $(n, n+3)=1$, then $3 \mid n$, let $n=3 k\left(k \in \mathbf{N}_{+}\right)$, then the equation transforms to $y=\frac{k+1}{k} x(0<x<3 k)$, which has two integer solutions.
Therefore, $f(1)+f(2)+\cdots+f(2006)$ represents twice the number of second category lattice points among $A_{1}, A_{2}, \cdots, A_{2006}$, which equals $2 \cdot\left[\frac{2006}{3}\right]=1336$.