Except for the first two terms, each term of the sequence $1000, x, 1000-x,\ldots$ is obtained by subtracting the preceding term from the one before that.  The last term of the sequence is the first negative term encounted.  What positive integer $x$ produces a sequence of maximum length?
1. **Define the sequence and initial terms:**
   The sequence is given as \(1000, x, 1000-x, \ldots\). Each term is obtained by subtracting the preceding term from the one before that.

2. **Compute the first few terms:**
   \[
   \begin{aligned}
   a_1 &= 1000, \\
   a_2 &= x, \\
   a_3 &= 1000 - x, \\
   a_4 &= x - (1000 - x) = 2x - 1000, \\
   a_5 &= (1000 - x) - (2x - 1000) = 2000 - 3x, \\
   a_6 &= (2x - 1000) - (2000 - 3x) = 5x - 3000, \\
   a_7 &= (2000 - 3x) - (5x - 3000) = 5000 - 8x, \\
   a_8 &= (5x - 3000) - (5000 - 8x) = 8000 - 13x.
   \end{aligned}
   \]

3. **Identify the general form of the terms:**
   Observing the pattern, we can express the \(n\)-th term using Fibonacci numbers \(F_n\):
   \[
   a_n = 1000 F_{n-2} - x F_{n-1} \quad \text{if } n \text{ is odd},
   \]
   \[
   a_n = x F_{n-1} - 1000 F_{n-2} \quad \text{if } n \text{ is even}.
   \]

4. **Determine the condition for the first negative term:**
   We want the first negative term, so we need:
   \[
   1000 F_{n-2} \geq x F_{n-1}.
   \]
   This can be rewritten as:
   \[
   x \leq 1000 \frac{F_{n-2}}{F_{n-1}}.
   \]

5. **Analyze the ratio of consecutive Fibonacci numbers:**
   The ratio \(\frac{F_{n-2}}{F_{n-1}}\) approaches \(\frac{2}{\sqrt{5} + 1}\) as \(n\) increases. This is derived from the properties of Fibonacci numbers and the golden ratio \(\phi = \frac{1 + \sqrt{5}}{2}\).

6. **Calculate the maximum \(x\):**
   Using the limit of the ratio:
   \[
   x \leq 1000 \cdot \frac{2}{\sqrt{5} + 1}.
   \]
   Simplify the expression:
   \[
   \frac{2}{\sqrt{5} + 1} = \frac{2(\sqrt{5} - 1)}{(\sqrt{5} + 1)(\sqrt{5} - 1)} = \frac{2(\sqrt{5} - 1)}{5 - 1} = \frac{2(\sqrt{5} - 1)}{4} = \frac{\sqrt{5} - 1}{2}.
   \]
   Therefore:
   \[
   x \leq 1000 \cdot \frac{\sqrt{5} - 1}{2} = 500 (\sqrt{5} - 1).
   \]

7. **Approximate and round down:**
   \[
   \sqrt{5} \approx 2.236,
   \]
   \[
   500 (\sqrt{5} - 1) \approx 500 (2.236 - 1) = 500 \cdot 1.236 = 618.
   \]

The final answer is \(\boxed{618}\).