# Permutations with Repetition Symbol

I am trying to compute this formula in Mathematica:

$$a = \sum_{n=0}^A P_A^{A-n,n}$$

Where A can be any positive number

The problem is that I am unable to find the symbol for permutations with repetition:

$$P_n^{n_1,n_2,...,n_m}$$

Note: I know that the result is going to be:

$$a = \sum_{n=0}^A P_A^{A-n,n} = 2^A$$

But I would like to compute it with the "Permutations with Repetition Symbol"

Let's define a function that calculates the number of permutations with repetitions, according to this definition:

$$Pr^{\ a,\,b,\,c,\,...}_{\ n}=\frac{n!}{a!\ b!\ c!\ ...}\ \ \ \ \ \ n=a+b+c+\ ...$$

Clear[pr]
pr[a__] := Plus[a]! / Times@@ ({a}!)


Then let's see if your sum evaluates symbolically:

Sum[pr[a - n, n], {n, 0, a}]
(* Out: 2^a*)


Look at that! It works!

A more direct route is built in, as @JM mentioned in comments. The number of permutations with repetitions corresponds to the multinomial coefficient, which is implemented in Mathematica as the Multinomial function:

Multinomial[2, 3, 4] == pr[2, 3, 4]    (* True *)


When called with two non-numerical arguments, Multinomial is evaluated to an equivalent Binomial call:

Multinomial[a, b]                      (* Out: Binomial[a + b, b] *)


With more than two non-numerical arguments it returns unevaluated (whereas pr[a, b, c] returns the definition, i.e. (a + b + c)! / (a! b! c!)).

In your case, @JM showed that your result can be obtained as follows:

Sum[Multinomial[a - n, n], {n, 0, a}]  (* Out: 2^a *)

• I was hoping the OP would supply the definition, but since you have already done so: Sum[Multinomial[a - n, n], {n, 0, a}]. May 12 '20 at 1:15
• @J.M. Thank you. That's certainly much tidier :-) May 12 '20 at 1:23
• So, should I accept MarcoB's answer, or the one of J.M.'s? I think both are great May 12 '20 at 4:47
• @Die If Marco edits his answer to include my observation, then accept his answer. May 12 '20 at 5:57
• @DieDauphin I've added J.M.'s Multinomial approach to my answer. May 12 '20 at 15:29

For fun (only):

☺ = 1 ## &[(+##)!, 1 ## & @@ ({##}!)^-1] &;

☺[a, b, c]


• This is so readable to a non-Mathematica user! (But it is fun! :) May 12 '20 at 9:53
• Hehe. I had to copy it into MMA and unravel it. The 1's got me :-) May 12 '20 at 15:10