is there a function to calculate the number of permutations with repetition in Python? I know with itertools I can generate them but I want only a faster way to do the calculation and avoid calculating the factorials, I'm not interested in generating all possible permutations.
Example: calculate the possible strings composed by 4 As, 3 Bs, 5 Cs.
res= 12!/(4!3!5!)
or in code:
from math import factorial
from functools import reduce
rep=[4,3,5]
result= factorial(sum(rep))//reduce(lambda x,y: x*y, map(factorial, rep))