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!
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.