How to find the non-zero points of this function Suppose I have a function like this:
$$ f(x) = \lfloor mx \rfloor - \left\lfloor \frac{\lfloor mr\rfloor}{r}x\right\rfloor$$
I am trying to find all of the $x$ that make $f(x)$ non-zero.  My first (naive) approach, was to take the derivative of it and find all of the critical points.  
The problem with this approach is that all of the points on this function are critical points, which makes sense, because the majority of the time this function is zero.
Some things that I have noticed are that if $m$ is a reduced fraction, such as $\frac{7}{15}$ and $r$ is a whole number such as $65536$, then some of the points where $f(x)$ is non-zero is when $x$ is a multiple of the denominator.
With the numbers I have given, the first few points were this function is non-zero are 15, 30, and 45.  But not all of the non-zero points are at multiples of 15.
What should be my next step in trying to find these points?
Some things to note:
$m$ is always going to be a fraction and
$r$ is always going to be a whole number.
 A: First, let's simplify by setting $y=\frac xr$ and $s=mr$: then we want to consider the function $\lfloor sy \rfloor - \lfloor \lfloor s \rfloor y \rfloor$. If $s$ is an integer, then this is identically $0$, so assue that $s$ is a nonintegral rational number. I'm also going to assume for simplicity that $s>0$.
The function $\lfloor sy \rfloor - \lfloor \lfloor s \rfloor y \rfloor$ equals $0$ unless there is an integer $k$ such that $\lfloor s \rfloor y < k \le sy$. Indeed, for each positive integer $k$, there is an interval of $y$-values for which this function is nonzero, namely the interval $\big[ \frac ks, \frac k{\lfloor s \rfloor} \big)$. The union of these intervals, over all positive integers $k$, is precisely the set of $y$ for which $\lfloor sy \rfloor - \lfloor \lfloor s \rfloor y \rfloor \ne 0$.
Note that these intervals will start to overlap when $k$ is large enough. In particular, it seems that if $s=\frac ab$ in lowest terms, then the intervals for $k=a-1$ and $k=a$ just barely touch and all future ones overlap; in particular, the function $\lfloor sy \rfloor - \lfloor \lfloor s \rfloor y \rfloor$ is always positive for $y\ge b$. Finally, if we write $\{z\}=z-\lfloor z\rfloor$ for the fractional part of $z$, note that
$$
\lfloor sy \rfloor - \lfloor \lfloor s \rfloor y \rfloor - \{s\} y = (sy-\{sy\}) - (\lfloor s\rfloor y - \{\lfloor s\rfloor y\}) - \{s\} y = \{\lfloor s\rfloor y\} - \{sy\}
$$
is a periodic function of $y$ with period $b$. In particular, $\lfloor sy \rfloor - \lfloor \lfloor s \rfloor y \rfloor$ grows roughly linearly in $y$, in that it equals $\{s\} y$ plus a bounded periodic function.
