Example 34 (2006 National Training Team Selection Exam Question) Given positive integers $m, a, b, (a, b)=1$. $A$ is a non-empty subset of the set of positive integers, such that for any positive integer $n$, either $a n \in A$ or $b n \in A$. For all sets $A$ that satisfy the above property, find the minimum value of $|A \cap\{1,2, \cdots, m\}|$.

---

The translation preserves the original text's line breaks and formatting.
(1) When $a=b=1$, $A \cap\{1,2, \cdots, m\}=\{1,2, \cdots, m\}$, hence $|A \cap\{1,2, \cdots, m\}|=m$.
(2) Suppose $a, b$ are not both 1, without loss of generality, assume $a>b$. Let
$A_{1}=\left\{k \mid\right.$ if $a^{l} \mid k, a^{l+1} \nmid k$, then $l$ is odd $\}$.
Now we verify that $A_{1}$ satisfies the requirements of the problem.
For any positive integer $n$, let $n=a^{l} n_{1}$, where $a$ does not divide $n_{1}$. When $2 \mid l$, then $a n=a^{l+1} n_{1} \in A_{1}$; if $2 \nmid l$, since $(a, b)=1$, hence $b n=a^{l} b n_{1} \in A_{1}$.
Moreover, the number of integers not exceeding $m$ and divisible by $a^{i}$ is $\left[\frac{m}{a^{i}}\right]$, so by the principle of inclusion-exclusion, we have
$|A \cap\{1,2, \cdots, m\}|=\sum_{i=1}^{\infty}(-1)^{i+1}\left[\frac{m}{a^{i}}\right]$.
Now we prove that when $a>b$, for any set $A$ with the properties described in the problem, we always have
$|A \cap\{1,2, \cdots, m\}| \geqslant \sum_{i=1}^{\infty}(-1)^{i+1}\left[\frac{m}{a^{i}}\right]$.
To prove this, consider the binary subsets:
$S_{k}=\{a k, b k\}$, where $k \leqslant \frac{m}{a}$, and the power of $a$ in $k$ is even (i.e., if $a^{l} \mid k$, but $a^{l+1} \nmid k$, then $l$ is even).
Since $(a, b)=1$, it is easy to see that $S_{k} \neq S_{k^{\prime}}$ (where $k^{\prime}$ has the same property as $k$). Additionally, since $a>b$, we have $1 \leqslant a k, b k \leqslant m$, so one of $a k, b k$ must belong to $A$. If the number of such binary subsets $S_{k}$ is $S$, then
$$
|A \cap\{1,2, \cdots, m\}| \geqslant S=\sum_{i=1}^{\infty}(-1)^{i+1}\left[\frac{m}{a^{i}}\right] .
$$
(The last step still uses the principle of inclusion-exclusion.)
Combining the above results, we know that the minimum value sought is $m$ (when $a=b=1$), and $\sum_{i=1}^{\infty}(-1)^{i+1}\left[\frac{m}{c^{i}}\right]$ [when $a, b$ are not both 1, here $c=\max (a, b)]$.