Getting solutions to questions with floor functions, like:
solve for x:$$ \left \lfloor{x} \right \rfloor\ - n \cdot \left \lfloor{\frac{x}{n}} \right \rfloor\ = y$$ $$st.: \ x ∈\{0, \mathbb{R^{+}} \}, \ y ∈\mathbb{Z},\ n ∈\mathbb{Z^{+}},$$
has troubled my little brain for some time now.
This equation, of course, isn't my actual problem, but if I learn how to solve it, I can work other problems. Can anyone help? I would really appreciate any guidance about the thought process required to get to the solution.
Thanks for taking the time.
This is not a good approach.
Assume $x$ is between two consecutive multiples of $n$, i.e. $$kn<x<(k+1)n$$
Then, $$\left\lfloor\frac{x}n\right\rfloor=k$$
Thus, $$\lfloor x\rfloor=y+kn\implies x=y+kn+f$$ where $0\le f<1$.
To satisfy the assumption, $$0<y+f<n$$
If $y,n$ are fixed, as long as $y<n$, we can obtain solutions by the above method.
On the other hand, one can show that if $n<y$, there are no solutions.
As an example, for $y=1,n=3$, the integer part of $x$ can be $1,4,7,10\cdots$.
In addition, $y<0$ has no solutions for $x$.
SUMMARY:
The above steps might be quite messy. Let me summarize the results:
When $y<0$, there are no solutions.
When $n<y$, there are no solutions.
When $n=y$, there are no solutions.
When $n>y$, the solutions are $$x=y+kn+f$$ where $k$ is an arbitrary natural number or zero, $f$ is an arbitrary fractional part.