2
$\begingroup$

I have been messing around analyzing some self-made algorithms and then I stumbled upon this summation:

$$\sum_{j=0}^{n}\left\lfloor{2^{i-j}}\right\rfloor$$

I am thinking that my common algebraic manipulations involving series won't apply because of the floor function.

I also tried entering this series in wolframalpha but no luck.

Does anyone know how to do this?

  • 1
    What is the role of 'i' in the summaiton?2017-02-20
  • 0
    It is a value from another series.2017-02-20
  • 1
    For every term discern two cases: $j\leq i$ and $j>i$.2017-02-20

2 Answers 2

4

Irrespective of the value of $i $, whether it is or not greater than $j $, we can write our sum as: $$S = \sum_{j=0}^{i} \lfloor 2^{i-j} \rfloor + \sum_{j=i+1}^{n} \lfloor 2^{i-j} \rfloor$$

Case $1$: If $i \geq n $, $$S = \sum_{j=0}^{n} \lfloor 2^{i-j} \rfloor = \sum_{j=0}^{n} 2^{i-j} (\text {why ?}) $$

Case $2$: If $i < n $, $$S = \sum_{j=0}^{i} \lfloor 2^{i-j} \rfloor + \sum_{j=i+1}^{n} \lfloor 2^{i-j} \rfloor$$ $$= \sum_{j=0}^{i} \lfloor 2^{i-j} \rfloor + 0 (\text {why?})$$ $$= \sum_{j=0}^{i} 2^{i-j}$$

The final result in both cases is an easily simplifiable geometric series. Hope it helps.

  • 0
    well, you are assuming that $i\in\Bbb Z$. But for $i\in\Bbb R$ this is not as easy.2017-02-20
  • 0
    I think in case 1, it is obvious since $2^{i-j}$ is expected to have 0 exponent or a positive one so a simple sum of geometric series can be applied. As for case 2, it seems that the whole sum was decomposed into sum of two summations, first from 0 to i then second from $i+1$ to $n$. Then the sum of all floors in this summation, $\sum_{j=i+1}^{n} \lfloor 2^{i-j} \rfloor$, is zero since the fraction $1/2^{j-i}$ is guaranteed to be positive and hence applying floor function to that fraction will result to zero. I hope this would shed some light.2017-02-21
3

Assuming that $i \in \mathbb{Z}$ and $n \in \mathbb{N}$, observe that as long as $j \leq i$ you have a normal summation, while in the other case, $0 \leq 2^k < 1$ for any $k < 0$. To deal with $i < 0$ we use $i' = \max(i,-1)$. Then we get:

\begin{align*} \sum_{j = 0}^{n} \lfloor 2^{i-j} \rfloor &= \sum_{j=0}^{\max(i,-1)} \lfloor 2^{i-j} \rfloor + \sum_{j=\max(i+1,0)}^{\max(n,i)} \lfloor 2^{i-j} \rfloor \\ &= \sum_{j=0}^{\max(i,-1)} 2^{i-j} + \sum_{j=\max(i+1,0)}^{\max(n,i)} \lfloor 2^{i-j} \rfloor \\ &= \sum_{k=0}^{\max(i,-1)} 2^k + \sum_{j=\max(i+1,0)}^{\max(n,i)} 0 \\ &= 2^{\max(i,-1)+1} -1 + 0 \\ &= 2^{\max(i+1,0)} - 1 \end{align*}

I hope this helps $\ddot\smile$