ength of :func:`distinct_permutations`. For example, there are 83,160 distinct anagrams of the word "abracadabra": >>> from more_itertools import distinct_permutations, ilen >>> ilen(distinct_permutations('abracadabra')) 83160 This can be computed directly from the letter counts, 5a 2b 2r 1c 1d: >>> from collections import Counter >>> list(Counter('abracadabra').values()) [5, 2, 2, 1, 1] >>> multinomial(5, 2, 1, 1, 2) 83160 A binomial coefficient is a special case of multinomial where there are only two categories. For example, the number of ways to arrange 12 balls with 5 reds and 7 blues is ``multinomial(5, 7)`` or ``math.comb(12, 5)``. When the multiplicities are all just 1, :func:`multinomial` is a special case of ``math.factorial`` so that ``multinomial(1, 1, 1, 1, 1, 1, 1) == math.factorial(7)``. Reference: https://en.wikipedia.org/wiki/Multinomial_theorem )