Piecewise function notation and applications I would like to define a piecewise function to imitate some physical phenomenon, which, for example, occurs once in a year (at June for a whole month long). Say, frequency/domain (integers) of the func is representing months, and January is at 0. 
How to say mathematically, that y=0 if x is not a member of positive Z which are divisible by smth (to imitate all months except for June) and y=1 if x is a member of pos. Z which are divisible by smth (to imitate June)?
For me here the problem also is that I cannot easily say that it is y=1 for all integers divisible by 6-1 (6 as a June and -1 to compensate for starting with January at 0) because it would also cover next January etc.
 A: Since $0$ corresponds to January, numbers that correspond to June are $5$, $17$, $22$, etc. That sequence increases by $12$ each time, so the difference between any two of them is some multiple of $12$. And because of this, if we divide any of them by $12$, we'll get an integer quotient representing the number of years, and a remainder of $5$.
One understandable, but nonstandard way to write your function would be something like:
$$f(n)=\begin{cases}
1 & \text{ if the remainder of }n\div12\text{ is }5\\
0 & \text{ otherwise}
\end{cases}$$
There is a special language and notation for dealing with things like this, in the words of so-called "modular arithmetic". Two integers whose difference is a multiple of $12$ are said to be "congruent modulo $12$", and we use the notation $n_1\equiv n_2\pmod {12}$ in math.
A more standard notation would be something like:
$$f(n)=\begin{cases}
1 & \text{ if }n\equiv5\pmod{12}\\
0 & \text{ otherwise}
\end{cases}$$
In some mathematics subfields, functions that are $1$ or $0$ in this way are common, and there are special notations like the Iverson bracket or indicator functions. But  these may not be universally understood.
Finally, in programming-related contexts, the calculation of the remainder is emphasized more than the equivalence, so they would be more likely to write things in terms of the modulo operation which outputs the remainder.
