# Permutations w/ constraints question

#### G_M_Vald

##### New Member
Hello Everyone!

I apologize, in advance, if I'm posting this query in the wrong thread...

My query:

Given a transpose 5-d vector, {d_1, d_2, d_3, d_4, d_5}, I allow d_i, where i=1,...5, to be an integer element between [1,n]. The possible permutations are

(1) n=1, 1^5=1; {1,1,1,1,1}
(2) n=2, 2^5=32; {1,1,1,1,1},{1,1,1,1,2},...,{2,2,2,2,2}
(3) n=3, 3^5=243; {1,1,1,1,1},{1,1,1,1,2},...,{3,3,3,3,3}
...
(m) n=m, m^5; {1,1,1,1,1},...{m,m,m,m,m}

(C1) My first constraint is to exclude any permutation where any d_i is repeated 3 or more times, e.g. {1,2,1,1,2}, {2,1,2,2,2}, {m,m,5,9,m}, etc.

d_i repeated twice, or d_i and d_j repeated twice is fine, e.g. {1,1,3,4,5}, {2,3,4,3,2}, etc.

(1) n=1, {1,1,1,1,1}, does not satisfy this constraint.
(2) n=2, {1,1,1,1,1},{1,1,1,1,2},...,{2,2,2,2,2}, does not satisfy this constraint either.
(3) n=3, {1,1,1,1,1},{1,1,1,1,2},...,{3,3,3,3,3}, has 90 permutations, of 243, that satisfy this constraint, specifically {1,1,2,2,3},...{3,3,2,2,1}.

Is there a mathematical formula, as a function of n, and i, i.e. n^i -(something) that gives the permutations for this constraint?

There's one more constraint after this one, specifically sum_i (d_i) leq p, but I need to get through the first constraint...first.

I very much appreciate nay help that is given. Again, if this is too elementary, and I've posted this on the wrong thread, I apologize. I'll move it to where it belongs.