Algebraic Closed Form for $\sum_{n=1}^{k}\left( n- 3 \lfloor \frac{n-1}{3} \rfloor\right)$
Writing down a couple of the sums:
$$1,3,6,7,9,12,13,15,18,\dots$$
and comparing that to the sequence$$1,3,5,7,9\cdots$$
gives you a clue that the difference between the arithmetic sequence and the sequence you want to describe is simply $$0,0,1,0,0,1,0,0,1,0,0,1\dots$$ which is a sequence you can describe in closed form in a way similar to $a_n$.
That is, you can see that $$\sum_{i=n}^k a_n = 2k-1 + b_k$$
where $b_k$ is equal to $1$ if $k$ is divisible by $3$ and $0$ otherwise.
You can express $b_n$ algebraically by taking $a_n$ and any function for which $f(1)=f(2)=0$ and $f(3)=1$, and you have $b_n=f(a_n)$.
I can't think of any "elegant" function $f$ at the moment, but a quadratic polynomial can surely do it, since we only have a restriction on three points. The quadratic polynomial that satisfies $f(1)=f(2)=0$ and $f(3)=1$ is $$f(x)=\frac12x^2-\frac32 x + 1.$$
Edit:
Thanks to BarryCipra, a nicer function (more in the spirit of your solution) for $b_k$ is
$$b_k = \left\lfloor 1 + \left\lfloor\frac k3\right\rfloor - \frac k3\right\rfloor$$