What function would do this
I need a function $f(n)$ that if $n$ is odd it returns $-1$, but if it is even it returns $1$. Is there a function like this? If so what is it? Also I would appreciate if it is not a trig function _(Ahem $f(n) = \cos(n\pi)$)_.
What you have defined is already a function, but I assume what you want is an elementary expression for it. Try $$(-1)^{n}$$