12
Given a list of integers, output the number of permutations of the integers, with indistinguishable permutations counted once. If there are n
integers, and each group of indistinguishable numbers has length n_i
, this is n! / (n_1! * n_2! * ...)
Rules
Input will be some form of list as arguments to a function or the program with 1 to 12 non-negative integers.
Output will be printing or returning the number of permutations as described above.
No standard loopholes or built-in functions (generating permutations, combinations, etc.). Factorials are allowed.
Test Cases
Inputs:
1, 3000, 2, 2, 8
1, 1, 1
2, 4, 3, 2, 3, 4, 4, 4, 4, 4, 1, 1
Outputs:
60
1
83160
when you say no builtins, does this include what I did when I used a builtin for generating all the permutations? – Maltysen – 2016-04-24T20:45:58.260
1
This looks largely the same as Compute the multinomial coefficient. Does counting identical entries for the input make it sufficiently different not to be a dupe?
– xnor – 2016-04-24T20:47:26.167@xnor well here you actually have to count the duplicates, so it's not as straightforward I suppose. The other is pretty much straight plugging in values. – qwr – 2016-04-24T20:50:03.867
@Maltysen sadly yes, I will have to update the question – qwr – 2016-04-24T20:50:26.833
Your test cases only include positive integers. Is that always the case? – Luis Mendo – 2016-04-24T21:09:42.670
1@LuisMendo Yes it is, though it should not make a difference as far as I can imagine – qwr – 2016-04-24T21:11:45.653
@qwr Well, it did in one of the approaches I was thinking of (I had to concatenate an element guaranteed to be different to any of the input numbers) – Luis Mendo – 2016-04-24T22:49:32.993