So suppose I have an ordered set of numbers: $(a_1, a_2, ..., a_n)$ and I want to express the following sum/product in an elegant manner:

$ a_1 + a_1 a_2 + a_1 a_2 a_3 + ... + a_1 a_2 ... a_n $

I could say this:

$\sum_{i=1}^n (\prod_{j=1}^{i}a_j )$

But I'm wondering if there is anything better. Thanks!

  • 1
    $\begingroup$ That looks as good as it gets. Anything better may just be subjective beyond this point. $\endgroup$ – Macavity Apr 4 '16 at 15:33

Another one could be $$a_1 ( 1+ a_2 ( 1+ a_3 (\dots (1+ a_{n-1}(1+a_n)) \dots ))).$$

Comptationally speaking, this is better than $\sum_{i=1}^n \prod_{j=1}^ia_j$, since the first one uses only $O(n)$ multiplications, while the second uses $O(n^2)$ multiplications.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.