407 From $1,2, \cdots, n$ choose any $k$ numbers, among which there must be three numbers that are pairwise not coprime. Find the minimum value of $k$, $f(n)$.

Translate the above text into English, please keep the original text's line breaks and format, and output the translation result directly.
Let the number of primes in $1,2, \cdots, m$ be denoted as $a_{m}$. Let $A=\left\{x \mid x=1\right.$ or $p$ or $p^{2}$, where $p$ is a prime, $\left.x \leqslant n\right\}$.
Then $|A|=a_{n}+1+a_{[\sqrt{n}]}$, where $[x]$ represents the greatest integer not exceeding the real number $x$.
Obviously, any three numbers in the set $A$ must have two that are coprime.
Therefore, $f(n) \geqslant a_{n}+2+a_{[\sqrt{n}]}$.
On the other hand, if $a_{n}+2+a_{[n]}$ numbers are selected from $1,2, \cdots, n$, consider the smallest prime factor $p$ of these numbers. When $p>\sqrt{n}$, the corresponding numbers are clearly prime, so there are at most $a_{n}-a_{[\sqrt{n}]}$ such numbers. The remaining numbers, excluding 1, have at least $2 a_{[\sqrt{a}]}+1$ numbers. By the pigeonhole principle, it is known that there must be three numbers with the same smallest prime factor, thus these three numbers are pairwise non-coprime.
In summary, $f(n)=a_{n}+2+a_{[\sqrt{n}]}$.
（Note: Zhengzhou Foreign Languages School, 450001）