I would like to define a function $f(n)$. It must be such that it should produce the sum of all elements till the nth term of the series mentioned below: $$2,2,2,3,3,3,4,4,4,4,5,5,5,6,6,6,7,7,7,7,8,8,8,9,9,9,10,10,10,10.........$$
I don't know what I must call this sequence, but it is something wherein for every three numbers or $3n^{th}$ number will repeat 4 times while the other numbers will repeat thrice.
$4,7,10,13,16,19,22................$ will repeat 4 times
For better representation,this sequence is just as same as: $$(2,2,2),(3,3,3),(4,4,4,4),(5,5,5),(6,6,6),(7,7,7,7),(8,8,8),(9,9,9),(10,10,10,10),(11.........$$
(The brackets do not have a special meaning)
Example:
$f(1) = 2$
$f(4) = 2+2+2+3$
$f(8) = 2+2+2+3+3+3+4+4$
Though it is easy to write an algorithm in Programming languages like Python or C+, I have no idea on how to represent this function mathematically. I am a novice to this, so please feel free to leave your advice and opinions here! Thank you!