From set {2, 2, 3, 5}, I can have 8 ways to generate unique multiplication result, which:
- two number multiplication: 2*2, 2*3, 2*5, 3*5
- three number multiplication: 2*2*3, 2*2*5, 2*3*5
- four number multiplication: 2*2*3*5
Then, how many unique multiplication result I can generate for following set
{ 11, 11, 11, 11, 11, 7, 7, 7, 7, 7, 5, 5, 5, 5, 3, 3, 3, 2, 2, 2}
What is the formula?
*Edit: only prime numbers are allowed in the set
n choose kformula to store combinations in anarray,list, etc. , remove the duplicates and count the length. and you have your answer – gkrls Aug 26 '14 at 16:57piare the distinct prime numbers in the (multi)set andniare the number of times the respectivepiappears, then the result isProduct(ni+1) - N - 1(oh andNis the number of disticnt primes.) So for you last example would be(5+1)*(5+1)*(4+1)*(3+1)*(3+1) - 5 - 1 = 2874– ypercubeᵀᴹ Aug 26 '14 at 17:09-N-1) calculation is needed because you don't include the "one factor" and the "zero factor" multiplications. – ypercubeᵀᴹ Aug 26 '14 at 17:26