I am trying to devise a function that maps $\mathbb{Z} \setminus \{0\}$ to $0$ and maps $0$ to $1$ that is not a piecewise function.
If $\mathbb{Z} \setminus \{0\}$ to $0$ and maps $0$ to $1$ is not possible then a function $\mathbb{N} \setminus \{0\}$ to $0$ and maps $0$ to $1$ could possibly work too.
Any help is much appreciated (I am really stuck on this one), thanks in advance for the help!
(Context: This is for a program I am trying to write without if statements)
You could take $\left\lfloor \frac{1}{n^2+1} \right\rfloor$.
If you want to avoid using floats and the floor function, but you are willing to use the absolute value, you can consider $\frac{1-\left|n\right|+\left|\left|n\right|-1\right|}{2}$