3. (2004 National High School Competition Question) For integers $n \geqslant 4$, find the smallest positive integer $f(n)$, such that for any positive integer $m$, any $f(n)$-element subset of the set $M=\{m, m+1, m+2, \cdots, m+n-1\}$ contains at least 3 pairwise coprime elements.
3. Let $S_{n}(m)=\{m, m+1, \cdots, m+n-1\}, A_{i}=\left\{t \mid t \in S_{n}(2)\right.$ and $t$ is divisible by $i\}(i=2,3)$. By the principle of inclusion-exclusion, we have $\left|A_{2} \cup A_{3}\right|=\left|A_{2}\right|+\left|A_{3}\right|-\left|A_{2} \cap A_{3}\right|=\left[\frac{n+1}{2}\right]+\left[\frac{n+1}{3}\right]-\left[\frac{n+1}{6}\right]$. If we choose 3 numbers from $A_{2} \cup A_{3}$, there must be 2 numbers that both belong to $A_{2}$ or both belong to $A_{3}$, and they are not coprime. Therefore, we have $f(n) \geqslant\left|A_{2} \cup A_{3}\right|+1=\left[\frac{n+1}{2}\right]+\left[\frac{n+2}{2}\right]-\left[\frac{n+1}{6}\right]+1$. Thus, $f(4) \geqslant 4, f(5) \geqslant 5, f(6) \geqslant 6$. 

Next, in $S_{4}(m)=\{m, m+1, m+2, m+3\}$, if $2 \mid m$, then $m+1, m+2, m+3$ are pairwise coprime; if $2 \nmid m$, then $m, m+1, m+2$ are pairwise coprime. Hence, $f(4) \leqslant 4$, and thus $f(4)=4$.

Similarly, in $S_{5}(m)=\{m, m+1, m+2, m+3, m+4\}$, there must be 3 numbers that are pairwise coprime, so $f(5) \leqslant 5$, and thus $f(5)=5$. In $S_{6}(m)=\{m, m+1, m+2, m+3, m+4, m+5\}$, the remainders of the 6 numbers when divided by 6 are $0,1,2,3,4,5$. Let's denote the 6 numbers in $S_{6}$ as $x_{0}, x_{1}, \cdots, x_{5}$, where $x_{i}$ has a remainder of $i$ when divided by 6 ($i=0,1,2, \cdots, 5$). If we choose any 5 numbers from $S_{6}(m)$ to form a set $X$, if $x_{0}$ or $x_{4}$, or $x_{5} \notin X$, then the 3 numbers $x_{1}, x_{2}, x_{3}$ in $X$ are pairwise coprime; if $x_{1} \notin X$, then the 3 numbers $x_{2}, x_{3}, x_{5}$ in $X$ are pairwise coprime; if $x_{2}$ or $x_{3} \notin X$, then the 3 numbers $x_{1}, x_{4}, x_{5}$ in $X$ are pairwise coprime. Therefore, $f(6) \leqslant 5$. For $n \geqslant 7$, let $g(n)=\left[\frac{n+1}{2}\right]+\left[\frac{n+1}{3}\right]-\left[\frac{n+1}{6}\right]+1$, and let $n=6 k+r(0 \leqslant r \leqslant 5)$, then $g(n)=\left\{\begin{array}{l}4 k+r+1(r=0,1,2,3) \\ 4 k+r(r=4,5)\end{array}\right.$.

Let $X$ be any $g(n)$-element subset of $S_{n}(m)$. We need to prove that $X$ must contain 3 numbers that are pairwise coprime. Divide the numbers in $S_{n}(m)$ into groups of 6 consecutive integers, forming $k$ groups, with the remaining $r$ numbers forming one group, a total of $k+1$ groups. For any $g(n)$-element subset $X$ of $S_{n}(m)$, when $r=0,1,2,3$, the first $k$ groups contain at least $4 k+1$ numbers from $X$, so there must be a group containing at least 5 numbers from $X$. By $f(6)=5$, we know that these 5 numbers must contain 3 numbers that are pairwise coprime. When $r=4,5$, if any of the first $k$ groups contains at least 5 numbers from $X$, then by the same reasoning, these 5 numbers must contain 3 numbers that are pairwise coprime. Otherwise, each of the first $k$ groups contains at most 4 numbers from $X$, but $|X|=4 k+r$, so each of the first $k$ groups contains exactly 4 numbers from $X$ and the $r$ numbers in the $(k+1)$-th group all belong to $X$. By $f(r)=r(r=4,5)$, we know that these $r$ numbers must contain 3 numbers that are pairwise coprime. This proves that any $g(n)$-element subset of $S_{n}(m)$ must contain 3 numbers that are pairwise coprime, so $f(n) \geqslant g(n)=\left[\frac{n+1}{2}\right]+\left[\frac{n+1}{3}\right]-\left[\frac{n+1}{6}\right]+1$. 

In summary, $f(n)=\left[\frac{n+1}{2}\right]+\left[\frac{n+1}{3}\right]-\left[\frac{n+1}{6}\right]+1$.