# A Function that could differentiate integers ($\in z^+$) from rest of positive real numbers

I need a function which could return a constant for all positive integers and another constant for rest of positive real numbers.

In piecewise function form, it is like this:-

$$f(n) = \begin{cases} constant1, & \text{if n \in z^+} \\ constant2, & \text{if n \in R^+ \text{&} \notin z^+ } \end{cases}$$

This sine function returns $$\space {0} \space \forall{\space{x}} \in z^+$$

$$\sin({{\pi}x})$$, but it doesn't return another constant value for all positive non-integers.

Or say I need a sort function which can do implicit case handling, purely with operations and such things.

• Why is piecewise form not satisfactory? It is a perfectly valid way to define a function.
– FXV
Jul 6 '19 at 8:16
• @FXV I know, but i am interested in finding such function. Also, there are some reasons for doing this(Like building more functions over that which doesn't require human to check again and again whether its integer or not.) Jul 6 '19 at 8:18
• I think your formulation is not correct. "Find a function" means to exihbit a function, the way you express it is entirely up to you - so piecewise constant is perfectly valid. If what you want is to find an expression for this function using a set of standard functions, then you should define which set of standard functions to start with.
– FXV
Jul 6 '19 at 8:29
• How about $\operatorname{sgn} (|\sin (\pi x)|)$? Jul 6 '19 at 9:44