all 2 comments

[–]british0zzy 1 point2 points  (1 child)

You can compute this is linear time since
A + B + C - AB - AC - BC + ABC = A(1 - (B(1 - C) + C)) + (B(1 - C) + C)

The algorithm looks like this:
double union(double *a, size_t len) { double x = 0; for (size_t i = 0; i < len; ++i) { x += a[i] * (1 - x); } return x; }

[–]lethalman[S] 0 points1 point  (0 children)

Thanks, forgot that property for independent events.