A differentsimilar, possibly simpler closed form is the following: set $$b_n=\left\lfloor\frac{-1+\sqrt{1+8n}}{2}\right\rfloor,$$$$b_n=\left\lfloor\frac{1+\sqrt{8n-7}}{2}\right\rfloor,$$ then $$a_n=\frac{b_n-1}{2}+\frac{n}{b_n}.$$$$a_n=\frac{b_n+1}{2}+\frac{n-1}{b_n}.$$ It is not hard to derive this from the observation that whenever $n$$n-1$ is a triangular number $k(k+1)/2$$k(k-1)/2$, one has $a_n=k$.