Function that sends $1,2,3,4$ to $0,1,1,0$ respectively I already got tired trying to think of a function $f:\{1,2,3,4\}\rightarrow \{0,1,1,0\}$ in other words:
$$f(1)=0\\f(2)=1\\f(3)=1\\f(4)=0$$
Don't suggest division in integers; it will not pass for me. Are there ways to implement it with modulo, absolute value, and so on, without conditions?

Look the example for Lagrange Interpolation, then it is easy to construct any function from any sequence to any sequence.
In this case : 
$$L(x)=\frac{1}{2}(x-1)(x-3)(x-4) + \frac{-1}{2}(x-1)(x-2)(x-4)$$
wich simplifies to:
$$L(x)=\frac{-1}{2}(x-1)(x-4)$$
which could possibly explain Jasper's answer, but since the method for derivation was not mentioned can not say for sure.
