I am working on dice probabilities and I need a function where every xth item of the set of positive integers > 0 (n) is 0 and 1 otherwise.* x is also a positive integers.
So, can you, without the use of indicator functions, find an elementary function that satisfies
$$f(n,x)= \begin{cases} 0 &\text{if $n \bmod x = 0$},\\ 1 &\text{if $n \bmod x > 0$} \end{cases}$$
I am trying to model a die roll where if you roll a max on the dice, you roll again and add the new roll. This is recursive, so long as you keep rolling the max amount on each roll. x, i the dice type (d4, d6, etc) and n is the number you want to roll. The probabilities are fairly simple except for the case there you roll max die. Under this system it is impossible to get a total roll of 6 on a d6, because you immediately roll the dice and add the new number.
Similar, to this question. But slightly more generalized. But it is trying to introduce a periodic function, similar to what I need.
* Obviously the inverse would work as well since 1- f(x) will flip the bit.