How do you solve $\sum_{k=0}^{\infty} \sum_{i=1}^{m-1} \left \lfloor \frac{x+im^k}{m^{k+1}} \right \rfloor$? Let $m > 1$ be an integer, x is a real number and $f(x)=\sum_{k=0}^{\infty} \sum_{i=1}^{m-1} \left \lfloor  \frac{x+im^k}{m^{k+1}}  \right \rfloor$
Do you have any idea how can I show this? 
$f(x)= 
\begin{cases}
    \left \lfloor x \right \rfloor & \text{if } x\geq 0\\
    \left \lfloor x+1 \right \rfloor & \text{if } x<0
\end{cases}$

Another solution:
We will use the identity $\left \lfloor nx\right \rfloor = \sum_{k = 0}^{n - 1} \left \lfloor x + \frac{k}{n} \right \rfloor$,
$\sum_{k=0}^{\infty} \sum_{i=1}^{m-1} \left \lfloor  \frac{x+im^k}{m^{k+1}}  \right \rfloor = \sum_{k=0}^{\infty} \sum_{i=1}^{m-1} \left \lfloor  \frac{x}{m^{k+1}} + \frac{i}{m}  \right \rfloor = \sum_{k=0}^{\infty}( \sum_{i=0}^{m-1} \left \lfloor  \frac{x}{m^{k+1}} + \frac{i}{m}  \right \rfloor - \left \lfloor \frac{x}{m^{k+1}}\right \rfloor)$
Now we can apply the identity from above on $\frac{x}{m^{k+1}}$, and we are left with,
$\sum_{k=0}^{\infty} \left \lfloor m \frac{x}{m^{k+1}} \right \rfloor - \left \lfloor \frac{x}{m^{k+1}} \right \rfloor = \sum_{k=0}^{\infty} \left \lfloor  \frac{x}{m^{k}}\right \rfloor - \left \lfloor \frac{x}{m^{k+1}}\right \rfloor$, this is just a telescoping series that converges to $\left \lfloor x\right \rfloor$ if we choose $x\geq0$. 
If x is negative then $- \left \lfloor \frac{x}{m^{k+1}}\right \rfloor$ turns into $+ 1$ as $ \frac{x}{m^{k+1}}$ aproaches 0 from the left. So the result holds.
