I’m engaged on cube chances and I want a operate the place each xth merchandise of the set of optimistic integers > 0 (n) is 0 and 1 in any other case.* x can be a optimistic integers.
So, are you able to, with out using indicator capabilities, discover an elementary operate that satisfies
start{circumstances} f(n Mod x = 0) = 1,& x,n in mathbb N
f(n Mod x > 0) = 0.
finish{circumstances}
I’m making an attempt to mannequin a die roll the place should you roll a max on the cube, you roll once more and add the brand new roll. That is recursive, as long as you retain rolling the max quantity on every roll. x, i the cube kind (d4, d6, and so forth) and n is the quantity you wish to roll. The chances are pretty easy besides for the case there you roll max die. Underneath this method it’s not possible to get a complete roll of 6 on a d6, since you instantly roll the cube and add the brand new quantity.
Related, to this query. However barely extra generalized. However it’s making an attempt to introduce a periodic operate, just like what I want.
* Clearly the inverse would work as nicely since 1- f(x) will flip the bit.