$2 \cdot 34$ Let $S$ be a subset of $\{1,2, \cdots, 1989\}$, and any two numbers in $S$ do not have a difference of 4 or 7. How many elements can $S$ have at most?
[Solution] First, note that in any 11 consecutive natural numbers in the set $\{1,2, \cdots, 1989\}$, at most 5 numbers can belong to $S$.
Take $T=\{1,2, \cdots, 11\}$ as an example to prove this. Consider the following subsets of $T$:
$\{1,5\},\{2,6\},\{3,7\},\{4,8\},\{5,9\},\{6,10\},\{7,11\}$,
$\{1,8\},\{2,9\},\{3,10\},\{4,11\}$.

Clearly, each number in $T$ belongs to exactly two of these 11 subsets. For any 6 numbers in $T$, they belong to exactly 12 of these subsets. By the pigeonhole principle, there must be two numbers that belong to the same subset, meaning their difference is 4 or 7. Therefore, no 6 numbers in $T$ can all belong to $S$.

On the other hand, in $T^{\prime}=\{1,3,4,6,9\}$, the difference between any two numbers is not 4 or 7, so they can all belong to the subset $S$. Hence, at most 5 numbers in $T$ can belong to $S$.

Since $1989=181 \times 11-2$, the number of elements in $S$ does not exceed 905. Additionally, the set
$$
\{1,3,4,6,9,12,14,15,17,20\}
$$
has the property that the difference between any two numbers is not 4 or 7. Therefore, the set
$$
\{k+11 n \mid k=1,3,4,6,9, n=0,1,2, \cdots, 180\}
$$
has the property that the difference between any two numbers is not 4 or 7, and it has 905 elements. Hence, $S$ can have at most 905 numbers.