14. Let $S=\left\{\left.\frac{l}{1997} \right\rvert\, l=0,1,2, \cdots, 1996\right\} . S$ contains three numbers $x, y, z$ that satisfy: $x^{2}+ y^{2}-z^{2}=1$. Find the minimum and maximum values of $x+y+z$.
14. Let $l=1997 x, m=1997 y, n=1997 z$, then $l, m, n \in\{0,1,2, \cdots, 1996\}$, and $l^{2}+m^{2}-n^{2}=1997^{2}$.

First, let's find the minimum value of $l+m+n$.
Fixing $l$, we have $(m-n)(m+n)=(1997-l)(1997+l)$. To make $m+n$ as small as possible, $m+n$ and $m-n$ should be as close as possible, but $m+n \geqslant \sqrt{(1997+l)(1997-l)}$. Let $l_{1}=1997-l$, then $l+m+n \geqslant 1997-l_{1}+\sqrt{l_{1}\left(3994-l_{1}\right)}$.

Assume $l \geqslant m$, then $l>1400$, so $1 \leqslant l_{1} \leqslant 60$.
Notice that $1997- l_{1}$ decreases by 1 as $l_{1}$ increases, but $\sqrt{l_{1}\left(3994-l_{1}\right)}$ increases rapidly, so the minimum value must be taken when $l_{1}$ is small.
(1) $l_{1}=1, (m+n)(m-n)=3993, m+n \geqslant 121$.

That is, when $l=1996$, $m+n+l \geqslant 1996+121=2117$.
(2) When $200 \leqslant l_{1} \leqslant 600$, $l+m+n \geqslant 1997-600+\sqrt{200 \times 3794}>2117$.
(3) When $50 \leqslant l_{1} \leqslant 200$, it is also easy to see that $l+m+n \geqslant 1997-200+\sqrt{50 \times 3994}>2117$.
(4) When $10 \leqslant l_{1} \leqslant 50$, $l+m+n \geqslant 1997-50+\sqrt{10 \times 3984}>2117$.
(5) When $5 \leqslant l_{1} \leqslant 10$, $l+m+n \geqslant 1997-10+\sqrt{5 \times 3989}>2117$.
(6) $l_{1}=4, l+m+n \geqslant 1997-4+2 \times 63>2117$.
(7) $l_{1}=3, (m-n)(m+n)=3 \times 3991$, then $(m+n)_{\text {min }}=307$, so $l+m+n=1997-3+307=2301$.
(8) $l_{1}=2, (m-n)(m+n)=998$, then $l+m+n \geqslant 1997-2+998>2117$.

In summary, $(l+m+n)_{\min }=2117$, equality holds when $l=1996, m=77, n=44$.

Next, let's find the maximum value of $l+m+n$.
We have $(m-n)(m+n)=l_{1}\left(3994-l_{1}\right)$, so $l_{1}<m-n \leqslant m+n<3994-l_{1}$, and $l_{1}, m-n, m+n, 3994-l_{1}$ are of the same parity (let $l_{1}=2$, and you can notice this). Therefore, $m-n \geqslant l_{1}+2$, then $m+n \leqslant \frac{\left(3994-l_{1}\right) l_{1}}{l_{1}+2}$, we guess the maximum value is achieved when the equality holds.

If the equality holds, then (i) $l_{1}$ is odd, it only needs $l_{1}+2 \mid\left(3994-l_{1}\right) l_{1}$;
(ii) $l_{1}$ is even, then not only does it need to be divisible, but the quotient must also be even.

Let $l^{\prime}=l_{1}+2$, then $\frac{\left(3994-l_{1}\right) l_{1}}{l_{1}+2}=3998-\left(l^{\prime}+\frac{2 \times 3996}{l^{\prime}}\right)$.
The condition for equality to hold, when $l^{\prime}$ is odd, is only that $l^{\prime} \mid 2 \times 3996$; when $l^{\prime}$ is even, it must be that $\frac{2 \times 3996}{l^{\prime}}$ is even, so only $l^{\prime} \mid 3996$.

Thus, $l+m+n \leqslant 5997-2\left(l^{\prime}+\frac{3996}{l^{\prime}}\right)$,
when $l^{\prime}=54$ or 74, $l+m+n \leqslant 5741$, we will prove that 5741 is the maximum value.
First, when $l^{\prime}$ is outside $[54,74]$, it is no longer necessary to verify.
When $l^{\prime} \in[54,74]$, the equality cannot hold.
Therefore, $l+m+n \leqslant 1997-l_{1}+\frac{l_{1}\left(3994-l_{1}\right)}{l_{1}+4} \leqslant 1997-l_{1}+\frac{71}{75}\left(3994-l_{1}\right)=$ $1997-l_{1}+\left(3994-l_{1}\right)-\frac{4}{75}\left(3994-l_{1}\right) \leqslant 6000-100-\frac{4}{75} \times 3750<5741$, hence $(l+m+n)_{\text {max }}=5741$, equality holds when $l=1945, m=1925, n=1871$.