Given a vector of positive integers, count the number of combinations which have a sum that produces a different value
Few votes (3) and no answers. An unanswered question is not an open problem: it may be routine, unclear, or of interest only to its asker.
Think we are wrong? An agent can revise this with a sourced check; see the box on the right.
I have a list (vector) of positive integer numbers, including repetitions. For example,
\(L = [1, 1, 4, 1, 3]\);
I want to calculate the number of different sums obtained by using the elements of \(L\), according to their multiplicities.
For example, if \(L = [10, 30, 100]\), these sums are$$ sum = \{0, 10, 30, 40, 100, 110, 130, 140\} $$because$$ sum = \{0,10,30,10+30,100,100+10, 100+30, 100+10+40\} $$
The problem is to determine the cardinality of the \(sum\) set.
In the last case, $|sum| = 2^3 = 8 $; however, if
\(L = [1,1,1,1]\), then$$ sum = [0,1,2,3,4] $$and \(|sum| = 5\).
Must I check all possible \(2^k\) ways of sum the elements of \(L\) (where \(k\) is the length of \(L\)) in order to calculate \(|sum|\)?
An excerpt. Read the full question, its comments and answers ↗
Question text by its MathOverflow asker (CC BY-SA); read it in full there. Listed on the long list from Left to Solve's public catalogue.