Out of pure interest, I would like to be able to construct a sequence as such:
$1, 2, 4, 6, 3, 8, 10, 12, 5, 14, 16 ,18, 7, ...$
Thus an odd number, followed by three even numbers, followed by an odd number, and so on. Furthermore, all numbers are used exactly once and are in ascending order of numbers not yet used. In particular, I want some "closed" formula that will give me this sequence.
Suppose I have such a closed form. Then the question arises, can I construct a general "closed" formula that will produce a sequence of $n$ even/odd numbers, followed by $m$ odd/even numbers, while still abiding to the acending numbers property and such that each number is also used only once?
I would really appreciate some help or insight on how to tackle this problem. Of course, other generalisations are possible (for other sets or subsets, other "rules" for the sequence) and I am also interested in those, but I would like to get a grasp on this idea first.
If we call the numbers in the sequence $a_i$ and start counting from $0$, we note that the odd numbers are in places that are a multiple of $4$. Then for those places a multiple of $4$, we have $a_i=\frac i2+1$. For places that are not multiples of $4$, $a_i$ is even. It is easiest to get a rule for the first of three even numbers, then correct for the shift for the other two. If $i \equiv 1 \pmod 4$, $a_i=6\cdot\frac {i-1}4+2$. We can add $1$ to $i$ and add $2$ to $a_i$, so we get $$a_i=\begin {cases} \frac i2+1&i \equiv 0 \pmod 4\\ 6\cdot\frac {i-1}4+2&i \equiv 1 \pmod 4\\ 6\cdot\frac {i-2}4+4&i \equiv 2 \pmod 4\\ 6\cdot\frac {i-3}4+6&i \equiv 3 \pmod 4\end {cases}$$