Proving that this function all over the positive integer gives us this sequence? Firstly, we have this sequence : $1,1,2,1,2,3,1,2,3,4,...$ which is the sequence of integers $1$ to $k$ followed by integers $1$ to $k+1$. We could say a fractal sequence.
Secondly, we have this formula : $$a_n=\frac{1}{2}(2n+\lfloor\sqrt{2n}+\frac{1}{2}\rfloor-\lfloor\sqrt {2n}+\frac{1}{2}\rfloor^2)$$ where $n\ge1$
$a_1=1$ ; $a_2=1$ ; $a_3=2$ ; $a_4=1$ ; $a_5=2$ ; $a_6=3$ ; $a_7=1$
I don't know for sure but i think this formula gives us this sequence.
How to prove this ?
 A: $\newcommand{\bb}[1]{\left( #1 \right)}$
$\newcommand{\f}[1]{\left\lfloor #1 \right\rfloor}$
Key observation: Given $m \in \Bbb{Z}^+$, if:
$$
\sum_{k=1}^m k = \frac{m(m+1)}{2} < n \leq \frac{(m+1)(m+2)}{2} = \sum_{k=1}^{m+1} k
$$
then:
$$
a_n = n - \frac{m(m+1)}{2}
$$
Now rewrite your formula in the following manner:
\begin{align*}
a_n &= n - \frac{1}{2}\bb{\f{\sqrt{2n} + \frac{1}{2}}^2 - \f{\sqrt{2n} + \frac{1}{2}}} \\
&= n - \frac{1}{2}\f{\sqrt{2n} + \frac{1}{2}}\bb{\f{\sqrt{2n} + \frac{1}{2}} - 1} \\
&= n - \frac{1}{2}\bb{\f{\sqrt{2n} - \frac{1}{2}} + 1}\f{\sqrt{2n} - \frac{1}{2}} \\
\end{align*}
Observe that if $\f{\sqrt{2n} - \frac{1}{2}} = m$, then we're done. Thus, it suffices to show that this indeed holds if $\frac{m(m+1)}{2} < n \leq \frac{(m+1)(m+2)}{2}$ for some $m \in \Bbb{Z}^+$. This is because:
\begin{align*}
\f{\sqrt{2n} - \frac{1}{2}} = m &\iff m \leq \sqrt{2n} - \frac{1}{2} < m + 1 \\
&\iff m + \frac{1}{2} \leq \sqrt{2n} < m + \frac{3}{2} \\
&\iff \bb{m + \frac{1}{2}}^2 \leq 2n < \bb{m + \frac{3}{2}}^2 \\
&\iff \frac{1}{2}\bb{m^2 + m + \frac{1}{4}} \leq n < \frac{1}{2}\bb{m^2  + 3m + \frac{9}{4}} \\
&\iff \frac{m(m+1)}{2} + \frac{1}{8} \leq n < \frac{(m+1)(m+2)}{2} + \frac{1}{8} \\
&\iff \frac{m(m+1)}{2} < n \leq \frac{(m+1)(m+2)}{2}
\end{align*}
where the last $\iff$ holds because $\frac{m(m+1)}{2},n,\frac{(m+1)(m+2)}{2}$ are all integers.
