Closed form for 1, 1, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 6, [closed]

I am looking for a closed form to the sequence $$1, 1, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6, 6, 6...$$ According to wolfram alpha the generating function is $$\frac{1+x^{2}+x^{4}}{1-x-x^{7}+x^{8}}$$ but I cannot figure out how to turn this into a closed form as when differentiating (to make a power series) the terms get very complicated. Any help is appreciated.


Solution 1:

Assuming the first term corresponds to $n=0$, one formula is $a_n = \biggl\lfloor \dfrac{3n+9}7 \biggr\rfloor$.

If you want a solution without floor or ceiling functions, you'll want to consider $a_n - \frac{3n}7$, which is a periodic function with period $7$ and thus can be written as a linear combination of the seven functions $e^{2\pi k n/7}$ $(0\le k\le 6)$.