Function that gives -1 and +1 with change in x. I need a function $f(x)$ that gives either $-1$ or $1$ based on $x$.
eg.

*

*when $x = 26$ it should give me $1$,

*when $x = 27$ it should give me $-1$,

*when $x = 28$ it should give me $1$,

and so on.
I know it had something to do with modulas(reminders of division), but i  can't get it.

What about this one (plot)
$$f(x) = 1-2\lfloor x \rfloor+4\lfloor x/2 \rfloor$$

