Suppose I have the rule
$$k \text{ mod } 2$$
Then $$0,1,2,3,4,5,6,...$$ produces $$0,1,0,1,0,1,0,...$$
I want to create a function that would allow me to do a sequence like 2-2-3
So I would have
$$0,1,2,3,4,5,6,...$$
and this would yield
$$0,1,0,1,0,1,2,...$$
What's the most elegant way to do this?
I intend to do this with arbitrary integers, so instead of 2-2-3, I might have 2-4-7-8, etc. So a solution stated generally would be best.