1. Let the sequence $\left\{a_{n}\right\}=\{1,2,2,3,3,3, \cdots, k, k, \cdots, k, \cdots\}$, where each positive integer $k$ appears $k$ times. Find the general term formula for $\left\{a_{n}\right\}$ and the sum of the first $n$ terms $S_{n}$.
$\begin{array}{l}\left(\text { Answer: } a_{\mathrm{n}}=\left[\frac{1+\sqrt{8 n-7}]}{2}\right], S_{\mathrm{n}}=k n-\frac{1}{6} k(k\right. \\ \left.+1)(k-1), k=\left[\frac{1+\sqrt{8 n-7}}{2}\right]\right)\end{array}$