Can $a \bmod 3$ be represented arithmetically without the mod or other integer-related functions? I've noticed that $a \bmod b$ (with 'mod' in the operational sense) can also be represented using various tricks of formulation. For instance, that
$$a \bmod b = a - b\left\lfloor\frac{a}{b}\right\rfloor .$$
There are several ways to do it by (ab)using various functions like ceiling, max, abs, and the like. However, I realized yesterday that
$$a \bmod 2 = \frac{1-(-1)^a}{2}.$$
I find this interesting as I consider basic exponentiation to be a purer operation in some sense than something like floor, perhaps in that it doesn't have a built-in sense of conditionality or knowledge of fractional parts. Furthermore, you can use substitution to reach arbitrarily high powers of $2$, as in
$$a \bmod 4 = \frac{1-(-1)^a}{2}+1-(-1)^{\frac{a-\frac{1-(-1)^a}{2}}{2}},$$
which amounts to right-shifting $a$ by one spot and repeating the process to get the second bit you need for the $\bmod 4$. I realize that's not pretty, but I'm interested that it's possible. The motivation here is identifying situations where formulae may implicitly support a richness of computational complexity one wouldn't expect, which parity detection and manipulation goes a long way towards. Which leads me to my question:
Is there some way using exponentiation or other basic operations to find a comparable expression for $a \bmod 3$, or ideally, $a \bmod b$?

Note that $\sin(2\pi n/3)=0, \dfrac{\sqrt3}2, $ or $-\dfrac{\sqrt3}2$, according as $n\equiv0, 1, $ or $2\bmod3$, respectively.
Furthermore, $f(x)=\dfrac{x\left(x-\dfrac{\sqrt3}2\right)2}{-\dfrac{\sqrt3}2\left(\dfrac{\sqrt3}2-\dfrac{\sqrt3}2\right)}+\dfrac{x\left(x+\dfrac{\sqrt3}2\right)1}{\dfrac{\sqrt3}2\left(\dfrac{\sqrt3}2+\dfrac{\sqrt3}2\right)}=\dfrac{3x^2-\dfrac{\sqrt3}2x}{\dfrac 32}=2x^2-\dfrac x{\sqrt3}$
has the property that $f(0)=0, f\left(\dfrac{\sqrt3}2\right)=1, $ and $f\left(-\dfrac{\sqrt3}2\right)=2$.
Therefore, $f(\sin(2\pi n/3))=2\sin^2(2\pi n/3)-\dfrac {\sin(2\pi n/3)}{\sqrt3}=n \bmod 3.$
