Is there any way of finding multiples of a given number , say p , in the range (x , y) {exclusive of x and y}
I found this question . But the answers only address the example given by the OP and not as general algorithm.
Is there any way of finding multiples of a given number , say p , in the range (x , y) {exclusive of x and y}
I found this question . But the answers only address the example given by the OP and not as general algorithm.
Here's a relatively simple solution: Let's assume $p$ is a natural number.
The first multiple of $p$ in $(x,y)$ will be $p \cdot (\lfloor x/p \rfloor + 1)$ and the last multiple will be $p \cdot (\lceil y/p \rceil - 1)$, where $\lceil \cdot \rceil$ stands for "round upwards" and $\lfloor \cdot \rfloor$ stands for "round downards".