How many permutations of the set n={1,2,3,3,3,4,4,5} are possible without any consecutive identical elements

combinatoricsdiscrete mathematicspermutations

I understand that there are
$\frac{8!}{3!2!}$=3600 permutations possible without any restrictions in place. I follow this by attaching all like elements as such {1,2,{3,3,3},{4,4},5} where I can account for 5! permutations where I have three 3s and two 4s in consecutive positions. However, when it comes to accounting for the permutations that, for example, will have three consecutives 3s but not so for the 4s, I am at a loss. I wrote some simple code and came up with a set of 960 permutations as the acceptable answer. As the question implies, I am unsure of how to reach that through other means. My apologies if this is considered elementary and I appreciate any help whatsoever.

Best Answer

One of the ways to approach it -

First place $1,2, 5$ ($3!$ ways). Then,

i) Place two $4$'s in four places between $\{ \ 1 \ 2 \ 5 \ \}$. You then have five digits and hence six places in between where you can place $3$.

So number of arrangements $ = \displaystyle 3! {4 \choose 2} {6 \choose 3} = 720$.

ii) Place both $4$'s in one of the four places between $\{ \ 1 \ 2 \ 5 \ \}$ separated by a $3 \ (434$ being together). With $434$ being together, you now have five places and choose two places for remaining two $3$'s.

Number of arrangements $ = \displaystyle 3! {4 \choose 1} {5 \choose 2} = 240$.

So, total number of valid arrangements $ = 720 + 240 = 960$.

Related Question