17 Let $u, v$ be positive real numbers, and for a given positive integer $n$, find the necessary and sufficient conditions for $u, v$ such that there exist real numbers $a_{1} \geqslant a_{2} \geqslant \cdots \geqslant a_{n}>0$ satisfying
$$\sum_{i=1}^{n} a_{i}=u, \sum_{i=1}^{n} a_{i}^{2}=v,$$

When these numbers exist, find the maximum and minimum values of $a_{1}$.
17. If there exist $a_{1}, a_{2}, \cdots, a_{n}$, by the Cauchy-Schwarz inequality, we have $\left(\sum_{i=1}^{n} a_{i}\right)^{2} \leqslant n \sum_{i=1}^{n} a_{i}^{2}$. Also, $\left(\sum_{i=1}^{n} a_{i}\right)^{2} \geqslant \sum_{i=1}^{n} a_{i}^{2}$, so the necessary condition for $u$ and $v$ is $v \leqslant u^{2} \leqslant n w \cdots$ (1). It can be proven that the above is also a sufficient condition. If (1) holds, take a positive number $a_{1}=\frac{u+\sqrt{(n-1)\left(n v-u^{2}\right)}}{n}$, then $a_{1} \leqslant u$. If $n>1$, take $a_{2}=a_{3}=\cdots=a_{n}=\frac{u-a_{1}}{n-1}$, then $\sum_{i=1}^{n} a_{i}=u, \sum_{i=1}^{n} a_{i}^{2}=v, a_{1} \geqslant \frac{u-a_{1}}{n-1}$. It can be proven that the maximum value of $a_{1}$ is $\frac{u+\sqrt{(n-1)\left(n v-u^{2}\right)}}{n}$. In fact, if $a_{1}>$ $\frac{u+\sqrt{(n-1)\left(n v-u^{2}\right)}}{n}$, then $n>1$, and $n a_{1}^{2}-2 u a_{1}+u^{2}-(n-1) v>0$, i.e., $(n-$ 1) $\left(v-a_{1}^{2}\right)a_{1}$ when using (4). Repeating the above steps a finite number of times, we get $v=\sum_{i=1}^{n} a_{i}^{2} \leqslant k a_{1}^{2}+$ $\left(u-k a_{1}\right)^{2} \cdots$ (5). Further, if $\frac{u}{k+1} \leqslant a_{1} \leqslant \frac{u}{k}$, by (5) we have $v=\sum_{i=1}^{n} a_{i}^{2} \leqslant k a_{1}^{2}+$ $\left(u-k a_{1}\right)^{2} \leqslant \frac{u^{2}}{k} \cdots$ (6). By (1), $\frac{u^{2}}{n} \leqslant v \leqslant u^{2}$, clearly $v=\frac{u^{2}}{n}$ if and only if $a_{1}=$ $a_{2}=\cdots=a_{n}=\frac{u}{n}$. If $v>\frac{u^{2}}{n}$, then there exists $k \in\{1,2, \cdots, n-1\}$, such that $\frac{u^{2}}{k+1}<v \leqslant \frac{u^{2}}{k}$. By (7) and (8), we have $a_{1} \leqslant \frac{k u-\sqrt{k\left[(k+1) v-u^{2}\right]}}{k(k+1)}\frac{u^{2}}{k+1}$, which contradicts $\frac{u^{2}}{k+1}<v \leqslant \frac{u^{2}}{k}$. Therefore, (7) holds. On the other hand, under the condition $\frac{u^{2}}{k+1}<v \leqslant \frac{u^{2}}{k}$, if $a_{1}=$ $\frac{k u+\sqrt{k\left[(k+1) v-u^{2}\right]}}{k(k+1)}$, then $\frac{u}{k+1}<a_{1} \leqslant \frac{u}{k}$ and $k(k+1) a_{1}^{2}-2 k u a_{1}+u^{2}-$ $v=0$, i.e., $v=k a_{1}^{2}+\left(u-k a_{1}\right)^{2}$. Let $a_{1}=\cdots=a_{k}=\frac{u}{k}, a_{k+1}=u-k a_{1}$, $a_{k+2}=\cdots=a_{n}=0$, then $a_{1}, a_{2}, \cdots, a_{n}$ satisfy the required conditions. Hence, when $\frac{u^{2}}{k+1}<v \leqslant \frac{u^{2}}{k}(k \in$ $\{1,2, \cdots, n-1\})$, the minimum value of $a_{1}$ is $\frac{k n+\sqrt{k\left[(k+1) v-u^{2}\right]}}{k(k+1)}$.