How $x \mod 2$ is in Elementary?

35 Views Asked by At

The function $$x\mapsto x\mod 2$$ should be in the complexity class Elementary (click it to see the definition of wikipedia). But using the definition, I don't see how to combine the functions to obtain the modulo. It should even be lower elementary (no need of the product)

1

There are 1 best solutions below

1
On BEST ANSWER

With $$ x\dot-y=\begin{cases}x-y&\text{if }x\ge y\\0&\text{otherwise}\end{cases}$$ and $$u(x)=(2\dot- x)\dot-((1\dot-x)+(1\dot-x))=\begin{cases}1&\text{if }x=1\\0&\text{otherwise}\end{cases}$$ we have $$ x\bmod 2=\sum_{k=0}^xu(x\dot-(k+k))$$ so we need only addition, (cut-off) subtraction and bounded summation