Let $S$ be the set of all positive integers from 1 through 1000 that are not perfect squares.  What is the length of the longest, non-constant, arithmetic sequence that consists of elements of $S$?
1. **Identify the set \( S \)**: The set \( S \) consists of all positive integers from 1 through 1000 that are not perfect squares. First, we need to determine the perfect squares within this range.
   - The smallest perfect square is \( 1^2 = 1 \).
   - The largest perfect square less than or equal to 1000 is \( 31^2 = 961 \) (since \( 32^2 = 1024 \) is greater than 1000).
   - Therefore, the perfect squares in this range are \( 1, 4, 9, 16, 25, \ldots, 961 \).

2. **Count the perfect squares**: There are 31 perfect squares from 1 to 1000 (since \( 31^2 = 961 \)).

3. **Determine the size of set \( S \)**: The total number of integers from 1 to 1000 is 1000. Subtracting the 31 perfect squares, we get:
   \[
   |S| = 1000 - 31 = 969
   \]

4. **Identify the properties of the sequence**: We need to find the longest non-constant arithmetic sequence within \( S \). An arithmetic sequence has a common difference \( d \) and can be written as \( a, a+d, a+2d, \ldots \).

5. **Consider the modulo condition**: The solution suggests considering numbers modulo 3. Note that:
   - A perfect square modulo 3 can only be \( 0 \) or \( 1 \) (since \( 0^2 \equiv 0 \mod 3 \) and \( 1^2 \equiv 1 \mod 3 \)).
   - Therefore, a number that is \( 2 \mod 3 \) cannot be a perfect square.

6. **Construct the sequence**: Consider the sequence of numbers that are \( 2 \mod 3 \) within the range 1 to 1000. The smallest such number is 2, and the largest is 998. This sequence is:
   \[
   2, 5, 8, 11, \ldots, 998
   \]
   This is an arithmetic sequence with the first term \( a = 2 \) and common difference \( d = 3 \).

7. **Determine the length of the sequence**: To find the number of terms in this sequence, use the formula for the \( n \)-th term of an arithmetic sequence:
   \[
   a_n = a + (n-1)d
   \]
   Setting \( a_n = 998 \), we get:
   \[
   998 = 2 + (n-1) \cdot 3
   \]
   Solving for \( n \):
   \[
   998 = 2 + 3n - 3 \implies 998 = 3n - 1 \implies 999 = 3n \implies n = \frac{999}{3} = 333
   \]

8. **Conclusion**: The length of the longest non-constant arithmetic sequence that consists of elements of \( S \) is 333.

The final answer is \(\boxed{333}\)