Consider a simple sum of floor functions:
$$S = c\left\lfloor \frac{x}{a}\right\rfloor + d\left\lfloor \frac{x}{b} \right\rfloor$$
Can we combine these two terms into a single function? I am trying to simplify something like this to avoid successive divisions in a computer program.
My question, in general, is: can we combine the following $k$ terms to avoid performing $k$ divisions and multiplications of $x$:
$$S(x,k)=\sum_{i=0}^{k}c_i\left\lfloor \frac{x}{a_i}\right\rfloor$$
No comments:
Post a Comment