3 Let $a_{i}=\min \left\{\left.k+\frac{i}{k} \right| \, k \in \mathbf{N}^{*}\right\}$, find the value of $S_{n}^{2}=\left[a_{1}\right]+ \left[a_{2}\right]+\cdots+\left[a_{n}^{2}\right]$, where $n \geqslant 2, [x]$ denotes the greatest integer not exceeding $x$. (Supplied by Zhang Pengcheng)
Let $a_{i+1}=\min \left\{\left.k+\frac{i+1}{k} \right| k \in \mathbf{N}^{*}\right\}=k_{1}+\frac{i+1}{k_{1}}\left(k_{1} \in \mathbf{N}^{*}\right)$, then $a_{i} \leqslant k_{1}+\frac{i}{k_{1}}<k_{1}+\frac{i+1}{k_{1}}=a_{i+1}$, which means the sequence $\left\{a_{n}\right\}$ is strictly increasing. Since $k+\frac{m^{2}}{k} \geqslant 2 m$ (equality holds when $k=m$), we have $a_{m}^{2}=2 m\left(m \in \mathbf{N}^{*}\right)$; also, when $k=m, m+1$, $k+\frac{m(m+1)}{k}=2 m+1$, and for $k \leqslant m$ or $k \geqslant m+1$, $(k-m)(k-m-1) \geqslant 0$, which implies $k^{2}-(2 m+1) k + m(m+1) \geqslant 0$, or $k+\frac{m(m+1)}{k} \geqslant 2 m+1$, so $a_{m}^{2}+m=2 m+1$. By the monotonicity of the sequence $\left\{a_{n}\right\}$, when $m^{2}+m \leqslant i<(m+1)^{2}$, $2 m+1 \leqslant a_{i}<2(m+1)$; when $m^{2}+m \leqslant i<(m+1)^{2}$, $2 m+1 \leqslant a_{i}<2(m+1)$, thus $\left[a_{i}\right]=\left\{\begin{array}{l}2 m, m^{2} \leqslant i<m^{2}+m, \\ 2 m+1, m^{2}+m \leqslant i<(m+1)^{2}\end{array}\right.$.

Therefore, $\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$, and thus
$$
\begin{aligned}
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}
$$