Let $x_1,x_2,x_3, \dots$ be a sequence of nonzero real numbers satisfying $$x_n=\frac{x_{n-2}x_{n-1}}{2x_{n-2}-x_{n-1}} \text{ for } n=3,4,5, \dots.$$ Establish necessary and sufficient conditions on $x_1$ and $x_2$ for $x_n$ to be an integer for infinitely many values of $n.$
1. **Given Recurrence Relation:**
   We start with the given recurrence relation for the sequence \( \{x_n\} \):
   \[
   x_n = \frac{x_{n-2} x_{n-1}}{2x_{n-2} - x_{n-1}} \quad \text{for} \quad n = 3, 4, 5, \dots
   \]

2. **Inductive Hypothesis:**
   We assume that the sequence can be expressed in a closed form. Let's try to find a pattern by induction. Suppose:
   \[
   x_n = \frac{x_1 x_2}{(x_1 - x_2)n + (2x_2 - x_1)}
   \]

3. **Base Cases:**
   - For \( n = 1 \), \( x_1 \) is given.
   - For \( n = 2 \), \( x_2 \) is given.

4. **Inductive Step:**
   Assume the formula holds for \( n \) and \( n-1 \). We need to show it holds for \( n+1 \):
   \[
   x_{n+1} = \frac{x_{n-1} x_n}{2x_{n-1} - x_n}
   \]
   Substitute the assumed forms of \( x_{n-1} \) and \( x_n \):
   \[
   x_{n-1} = \frac{x_1 x_2}{(x_1 - x_2)(n-1) + (2x_2 - x_1)}
   \]
   \[
   x_n = \frac{x_1 x_2}{(x_1 - x_2)n + (2x_2 - x_1)}
   \]

5. **Simplifying the Expression:**
   Substitute these into the recurrence relation:
   \[
   x_{n+1} = \frac{\left( \frac{x_1 x_2}{(x_1 - x_2)(n-1) + (2x_2 - x_1)} \right) \left( \frac{x_1 x_2}{(x_1 - x_2)n + (2x_2 - x_1)} \right)}{2 \left( \frac{x_1 x_2}{(x_1 - x_2)(n-1) + (2x_2 - x_1)} \right) - \left( \frac{x_1 x_2}{(x_1 - x_2)n + (2x_2 - x_1)} \right)}
   \]

6. **Combining Fractions:**
   Simplify the numerator and the denominator:
   \[
   x_{n+1} = \frac{x_1^2 x_2^2}{\left( (x_1 - x_2)(n-1) + (2x_2 - x_1) \right) \left( (x_1 - x_2)n + (2x_2 - x_1) \right)}
   \]
   \[
   x_{n+1} = \frac{x_1^2 x_2^2}{(x_1 - x_2)^2 n(n-1) + (x_1 - x_2)(2x_2 - x_1)n + (x_1 - x_2)(2x_2 - x_1)(n-1) + (2x_2 - x_1)^2}
   \]

7. **Analyzing the Denominator:**
   The denominator grows faster than the numerator as \( n \) increases, unless \( x_1 = x_2 \). If \( x_1 \neq x_2 \), the denominator will not simplify to an integer form for large \( n \).

8. **Special Case \( x_1 = x_2 \):**
   If \( x_1 = x_2 \), the recurrence relation simplifies significantly:
   \[
   x_n = \frac{x_1 x_1}{(x_1 - x_1)n + (2x_1 - x_1)} = x_1
   \]
   Thus, \( x_n = x_1 \) for all \( n \), and \( x_n \) is an integer for infinitely many values of \( n \).

9. **Conclusion:**
   The necessary and sufficient condition for \( x_n \) to be an integer for infinitely many values of \( n \) is that \( x_1 = x_2 \in \mathbb{Z} \setminus \{0\} \).

The final answer is \( \boxed{ x_1 = x_2 \in \mathbb{Z} \setminus \{0\} } \)