Question:
Let $a_n$ be the $nth$ term of the sequence $1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6\dots$, constructed by including the integer $k$ exactly $k$ times. Show that $a_n = \lfloor \sqrt{2n} + \dfrac{1}{2}\rfloor$.
Attempt:
Try to prove $k = a_n=\lfloor \sqrt{2n} + \dfrac{1}{2}\rfloor$ then $k = a_{n+k-1}=\lfloor \sqrt{2(n+k-1)} + \dfrac{1}{2}\rfloor$.
The inequality of $k = a_n=\lfloor \sqrt{2n} + \dfrac{1}{2}\rfloor$, is the following,
$$k \leq \sqrt{2n} + \dfrac{1}{2} < k + 1$$ $$k-\dfrac{1}{2} \leq \sqrt{2n} < k + \dfrac{1}{2}$$ $$\Big( k-\dfrac{1}{2} \Big)^2 \leq 2n < \Big(k +\dfrac{1}{2}\Big)^2$$ $$\dfrac{1}{2}\Big( k-\dfrac{1}{2} \Big)^2 \leq n < \dfrac{1}{2}\Big(k +\dfrac{1}{2}\Big)^2$$ $$\dfrac{1}{2}\Big( k-\dfrac{1}{2} \Big)^2 + k - 1 \leq n + k -1 < \dfrac{1}{2}\Big(k +\dfrac{1}{2}\Big)^2 + k - 1$$ $$\Big( k-\dfrac{1}{2} \Big)^2 + 2k - 2 \leq 2(n + k -1) < \Big(k +\dfrac{1}{2}\Big)^2 + 2k - 2$$ $$k^2 - k + \dfrac{1}{4} + 2k - 2 \leq 2(n+k - 1) < k^2 + k + \dfrac{1}{4} + 2k - 2$$ $$k^2 + k + \dfrac{1}{4} - 2 \leq 2(n+k - 1) < k^2 + 3k + \dfrac{9}{4} - \dfrac{9}{4} + \dfrac{1}{4} - 2$$ $$\Big( k+\dfrac{1}{2} \Big)^2 - 2 \leq 2(n+k - 1) < \Big( k+\dfrac{3}{2} \Big)^2 - 4$$
From here $2(n+k - 1) < \Big( k+\dfrac{3}{2} \Big)^2 - 4 \implies 2(n+k - 1) < \Big( k+\dfrac{3}{2} \Big)^2$ so I can take the square root of both sides. The problem is the left hand side, $\Big( k+\dfrac{1}{2} \Big)^2 - 2 \leq 2(n+k - 1)$ does not imply $\Big( k+\dfrac{1}{2} \Big)^2 \nleq 2(n+k - 1)$, thus we can't really get rid of the square.
It is easy to see that if we have $k = a_{n+k}=\lfloor \sqrt{2(n+k)} + \dfrac{1}{2}\rfloor$, the problems we encountered are avoided, but $k \neq a_{n+k}$.