Let $S=\{1,2, \ldots, n\}, A$ be an arithmetic sequence with at least two terms, a positive common difference, all of whose terms are in $S$, and such that adding any other element of $S$ to $A$ does not form an arithmetic sequence with the same common difference as $A$. Find the number of such $A$s. (Here, a sequence with only two terms is also considered an arithmetic sequence).
Solution 1
Let the common difference of $A$ be $d$, then $1 \leqslant d \leqslant n-1$.
We discuss in two cases:
(a) Suppose $n$ is even, then
when $1 \leqslant d \leqslant \frac{n}{2}$, there are $d$ $A$s with a common difference of $d$;
when $\frac{n}{2}+1 \leqslant d \leqslant n-1$, there are $n-d$ $A$s with a common difference of $d$.
Therefore, when $n$ is even, the total number of such $A$s is
$$
\left(1+2+\cdots+\frac{n}{2}\right)+\left\{1+2+\cdots+\left[n-\left(\frac{n}{2}+1\right)\right]\right\}=\frac{n^{2}}{4} \text { (cases). }
$$
(b) Suppose $n$ is odd, then

when $1 \leqslant d \leqslant \frac{n-1}{2}$, there are $d$ $A$s with a common difference of $d$; when $\frac{n+1}{2} \leqslant d \leqslant n-1$, there are $n-d$ $A$s with a common difference of $d$.
Therefore, when $n$ is odd, the total number of such $A$s is
$$
\left(1+2+\cdots+\frac{n-1}{2}\right)+\left(1+2+\cdots+\frac{n-1}{2}\right)=\frac{n^{2}-1}{4} \text { (cases). }
$$

Both cases can be unified as: the number of such $A$s is $\left[\frac{n^{2}}{4}\right]$.
Solution 2
For $n=2 k$, the sequence $A$ must have two consecutive terms, one in $\{1,2, \cdots, k\}$ and the other in $\{k+1, k+2, \cdots, n\}$.

Conversely, by choosing any number from $\{1,2, \cdots, k\}$ and any number from $\{k+1, k+2, \cdots, n\}$, a sequence $A$ can be constructed with their difference as the common difference. This correspondence is one-to-one.
Therefore, the number of such $A$s is
$$
k^{2}=\frac{n^{2}}{4} .
$$

For $n=2 k+1$, the situation is similar. Note that the set $\{k+1, k+2, \cdots, n\}$ contains $k+1$ numbers, so the number of such $A$s is
$$
k(k+1)=\left(n^{2}-1\right) / 4 .
$$

Both formulas can be unified as $\left[\frac{n^{2}}{4}\right]$.