Is it possible to find the inverse of a function which contains the term $(-1)^n$?
Specifically: I want to find the inverse of the following function, which gives the nth number of the form $6k\pm1$: $$ f(n) = 3n + \frac{3}{2} - \frac{(-1)^n}{2} $$
Since it is not possible to take the log to base -1 and I'm not a mathematician, I didn't suceed with my attempts of solving for $f(n)$. (Google search and Wolfram Alpha didn't help either, and based on the fact that $(-1)^n$ "looses" information about n I doubt it's possible in general)
For $n$ even we have $$f(n)=3n+1$$ and you can write $$\frac{f(n)-1}{3}=n$$ If $n$ is odd then you will get $$f(n)=3n+2$$ so $$n=\frac{f(n)-2}{3}$$