17.1.17 $\underset{\star}{\star \star}$ Let $a_{i}=\min \left\{k+\frac{i}{k}, k \right.$ is a positive integer $\}$. Try to find $S_{n^{2}}=\left[a_{1}\right]+\left[a_{2}\right]+\cdots$ $+\left[a_{n^{2}}\right]$, where $n \geqslant 2$.
Let $a_{i+1}=\min \left\{k+\frac{i+1}{k}\right\}=k_{0}+\frac{i+1}{k_{0}}$, then $a_{i+1}>k_{0}+\frac{i}{k_{0}} \geqslant \min \left\{k+\frac{i}{k}\right\}=a_{i}$, which means the sequence $\left\{a_{n}\right\}$ is strictly increasing.
Since $k+\frac{m^{2}}{k} \geqslant 2 m$, with equality when $k=m$, so $a_{m^{2}}=2 m$.
Since $k+\frac{m(m+1)}{k} \geqslant m+\frac{m(m+1)}{m}=m+1+\frac{m(m+1)}{m+1}=2 m+1$, with equality when $k=m, m+1$, so $a_{m(m+1)}=2 m+1$.
By the monotonicity of the sequence $\left\{a_{n}\right\}$,
$$
\left[a_{i}\right]=\left\{\begin{array}{ll}
2 m, & m^{2}<i<m(m+1) \\
2 m+1, & m(m+1) \leqslant i<(m+1)^{2}
\end{array}\right.
$$

Therefore,
$$
\begin{aligned}
\sum_{i=m^{2}}^{m^{2}+2 m}\left[a_{i}\right]= & 2 m \cdot m+(2 m+1) \cdot(m+1)=4 m^{2}+3 m+1 \\
S_{n}^{2}= & \sum_{m=1}^{n-1}\left(4 m^{2}+3 m+1\right)+2 n=4 \times \frac{n(n-1)(2 n-1)}{6} \\
& +3 \times \frac{n(n-1)}{2}+(n-1)+2 n=\frac{8 n^{3}-3 n^{2}+13 n-6}{6}
\end{aligned}
$$

For a positive integer $t$, let $n^{2} \leqslant t<(n+1)^{2}$.
When $n^{2} \leqslant t<n^{2}+n$, $S_{t}=\frac{8 n^{3}-3 n^{2}+13 n-6}{6}+2 n\left(t-n^{2}\right)=2 n t-$
$$
\frac{4 n^{3}+3 n^{2}-13 n+6}{6}
$$

When $n^{2}+n \leqslant t<(n+1)^{2}$, $S_{t}=\frac{8 n^{3}-3 n^{2}+13 n-6}{6}+2 n(n-1)+(2 n+1)$
$$
\left(t-n^{2}-n\right)=(2 n+1) t-\frac{4 n^{3}+9 n^{2}+5 n+6}{6} .
$$