I want to come up with a closed formula for generating the sequence: $$ \{1,1,3,3,5,5,7,7,9,9,11,11,...\} $$
It is possible to generate the odd numbers by $$ a_n = 2n+1 $$
The problem is to make every term repeat itself once sequentially. The sequence $$ a_n = 2n+(-1)^n $$ generates $\{1,1,5,5,9,9,11,11,\dots\}$.
I can't think of a solution. Is there any?
We want a function $f$ that gives $f(n)=n$ if $n$ is odd and $f(n)=n+1$ if $n$ is even.
We can let $f(n)=n+g(n)$ where $g$ is a function such that $g(n)=0$ if $n$ is odd and $g(n)=1$ if $n$ is even. We can take a modification of cos to get $g(x)=\cos^2(\frac{\pi x}{2})$.
So we get $f(x)=x+ \cos^2(\frac{\pi x}{2})$
Another posibility for $g(x)$ is $\frac{1}{2} + \frac{(-1)^n}{2}$