I'd like to get help with achieving periodicity.
Let's say I have a positive power $n$ of $2$:
$$2^n$$
I need to alter the sign of $n$ periodically according to the next behavior:
With integers from 0 to 5 sign should be +, with integers 6 and 11 sign should be -. Integers 12 to 17 should map to +, 18 ... 23 to -, and so on.
How do I alter the sign of the $n$ according to my definition? Should it be done with mod, sin, ???
Afterthought
This can probably be thought as periodicity of six rather than complex oscillations between 5, 6 and 12.
The simplest way is using floor function: $$(-1)^{\lfloor\frac n6\rfloor}2^n$$
Trigonometric functons have a problem: a function like $\lfloor\sin \frac {\pi n}6 \rfloor$ will yield $0$ when $n$ is a multiple of $6$.