# Is there an expression for a function that maps integers to one and non-integers to zero?

Is there a function that can be built with addition, multiplication, exponentiation, trigonometric functions, integrals, (and all of their inverses i.e subtraction, division, taking logarithms, $\arcsin(x)$, derivatives, etc) that would take an integer and output $1$ and take a non-integer and output $0$?
I looked at the Dirichlet Function but it separated rationals from irrationals, and the only solution that I could come up with was with the Fourier Series of $$x-\lfloor x \rfloor = \frac 12 - \frac 1\pi \sum_{k=1}^\infty \frac 1k \sin (2 \pi k x)$$ But this uses infinite series. Is there a way to build such a function? If there is not, why not?

• It's trivial. Just take the left side of what you have in your formula above and call 1 iff it is 0, 0 otherwise. – Yiannis Galidakis Mar 12 '16 at 17:55
• For your example, do you mean $1 - (\lceil x \rceil - \lfloor x \rfloor)$ instead of $x - \lfloor x \rfloor$? The latter is a sawtooth wave not an indicator function for the integers. – Dan Brumleve Mar 13 '16 at 0:03

Maybe this is cheating, but I don't think it's possible otherwise, since all of the other functions are continuous and a composition of continuous functions is continuous, integrals preserve continuity too, and even though differentiation doesn't in general, all of the functions you listed are not just continuous but analytic or infinitely differentiable so their derivatives are continuous as well at all orders. Anyway, here is my example:

$f(x) = 0^{\sin(\pi \cdot x)^2}$

For this to be correct you have to define $0^0=1$ which is not an unreasonable choice, but usually this expression is left undefined.

• Wow, that is a really clever answer, I know I did not mention limits as possible building blocks for the function, but would $f(x) = \lim_{n \to x} 0^{\sin(\pi n)^2}$ be an equivalent statement to the one you gave? – Guacho Perez Mar 13 '16 at 6:36
• Unfortunately no, that function is identically $0$ (regardless of how one defines $0^0$), for example: wolframalpha.com/input/… – Dan Brumleve Mar 13 '16 at 6:42
• Is allowing limits the same as allowing derivatives? – Dan Brumleve Mar 13 '16 at 6:49
• Yes, I think that in some twisted way allowing limits is the same thing as allowing derivatives. – Guacho Perez Mar 13 '16 at 7:14

It can be simply defined as an infinite product $$f(x)=\prod_{n=1}^{\infty}\cos^{2n}(\frac{\tau x}{2})$$ Where $\tau=2\pi$

• Welcome to Math.SE! You could explain in your answer why this function is an answer to the question (it is not obvious to me). – fonini Jun 23 '16 at 23:57

Well.. you can always built it as a distribution:

$$\Upsilon(x) = \begin{cases} 1 ~~~ \text{for} ~~~ x\in\mathbb{N} \\ 0 ~~~ \text{for} ~~~x\not\in\mathbb{N} \end{cases}$$

lol

• I think "built with" means composition of functions. – Dan Brumleve Mar 13 '16 at 0:20
• Also allowed are applications of integrals and derivatives... But I don't see how that can be used to contruct an if-then statement, I explained why in my answer. – Dan Brumleve Mar 13 '16 at 0:28
• (Also, this isn't what is usually meant by the word 'distribution'; the standard terminology is "piecewise function") – Eric Stucky Mar 13 '16 at 0:43
• I just wanted to give a funny answer >.< – Von Neumann Mar 13 '16 at 0:49