The question is, how many multiplication and addition operations are required to determine:

$\displaystyle

\sum_{i=1}^{n}\ \sum_{j=1}^{i} a_{i}b_{j}\

$

And modify the sum to reduce the number of computations.

Are there (n-1) + n(i-1) addition operations (outer loop and inner loop respectively) and n*i multiplication operations?

Also, can it be rewritten as

$\displaystyle

n\sum_{j=1}^{i} a_{i}b_{j}\

$

Thanks.