How may the following programming statement be written as summation?
k = 0;
for i = 0 to n-1 {
for j = 1 to C[i] {
sum = sum + binom(i,k);
k++;
}
}
I started with $$\sum_{i=0}^{n-1}\sum_{j=1}^{C_i} \binom{i}{k}$$ but don't know how to accomodate $k$.
Best Answer
We use the convention that empty sums, i.e. sums with upper limit less than the lower limit are considered to be zero. We also use the convention \begin{align*} \binom{n}{k}=0\qquad\qquad 0\leq n<k \end{align*}
We can also shift the index $j$ to obtain (by setting $C_{-1}:=0$)