Arranging three groups around a table so that no two people wearing the same color shirt are adjacent Say there are 10 blue shirt people, 8 red shirt people, and 5 green shirt people. How many ways are there to arrange them around a table (circle) so that no two people of same shirt color sit next to each other?
What I think: I tried to approach this in the same way as if it was just alternating two groups, where id seat the blue shirt people first giving me $9!8!5!$. Is this right? If not how would I approach this
 A: *

*Designate one blue shirt as true blue for reference point


*Place $10$ blues in a circle with gaps


*Fill $10$ gaps with $10$ blanks


*$3$ extra can either be in one, two, or three slots, eg if in one slot, colored red-green-red-green or green-red-green-red. So placed in $2\cdot10$ ways. Placing the remaining green in $\binom 93$ ways completes this pattern. And if on three slots,will have two blanks each in 3 slots , with green-red or red-green. Thus placement will be in $2^3\binom{10}3\times \binom72$


*Work out similarly if the three extras are in two slots, add up for all the possible patterns and multiply by $9!8!5!$ for people placement
Added working for case 3

*

*RGR, RG/GR: $2*10*9*\binom83$

*GRG, RG/GR: $2*10*9*\binom82$
Before multiplying by $9!8!5!$, the total comes to $36960$
A: These kind of problems are solved by a technique known as dynamic programming in computer science. You don't need to know what that is to solve this problem though. I'm gonna explain the whole idea in a simplistic manner below.
suppose we force the first person to sit in the circle to be blue. Then we try to fill the remaining people incrementally.
We define $b_{x, y, z}$ as the number of ways x blue shirts, y red shirts and z green shirts can fill the remainder of the circle such that the first person to sit at the table can't be blue and the last person won't be blue naturally (since the first of the circle was fixed blue initially).
Furthermore we define, $r_{x, y, z}$ as the number of ways x blue shirts, y red and z green shirts can fill the remainder of the circle such that the first person to sit at the table can't be red and the last person won't be blue (for the same resason as before).
And finally we define, $g_{x, y, z}$ as the number of ways x blue, y red and z green shirst can fill the remainder of the circle such that the first person won't be green and the last person won't be blue.
We have:
$$b_{x, y, z} = r_{x, y - 1, z} + g_{x, y, z - 1}.$$
Because if you can't put a blue person as the first one, you either have to put a red one or a green one.
$$r_{x, y, z} = b_{x - 1, y, z} + g_{x, y, z - 1}.$$
$$g_{x, y, z} = b_{x - 1, y, z} + r_{x, y - 1, z}.$$
The latter two recurrence relations have a simillar logic to the first one.
The only remaining thing is to find a basis for these recurrence relations and then start filling a three-dimensional table bottom-up to find out the value for b_{9, 8, 5} which would be the answer to your question.
The basis for these relations are:
$$b_{0, ..., ...} = 0$$
$$r_{..., 0, ...} = 0$$
$$g_{..., ..., 0} = 0$$
A: Suppose that Adam is one of the people wearing a blue shirt.  We will use him as our reference point.
Before we do so, let's begin by arranging ten blue balls, eight red balls, and five green balls in a circle so that no two balls of the same color are adjacent.  Arrange the ten blue balls in a circle.  Place Adam's name on one of the blue balls so that we can use that ball as a reference point.
Placing the ten blue balls in a circle creates ten spaces, one to the left of each ball, where the red balls and green balls can be placed to separate the blue balls.
At least seven of these spaces must be filled with red balls since if only six spaces were filled with red balls, then there would be three red balls in one space or two red balls in two spaces, making it impossible to separate the red balls with green balls once we filled the remaining four spaces between two blue balls with green balls.
The eight red balls are placed in eight of the ten spaces between two blue balls:  There are $\binom{10}{8}$ ways to place the eight red balls in eight of the ten spaces between two blue balls.  To separate the blue balls, we must a green ball in each of the remaining two spaces between two blue balls.  That leaves three green balls to distribute.  Since no green balls can be adjacent, we must place the remaining green balls in spaces between two blue balls already containing a red ball.  To ensure that no two of the remaining three green balls are adjacent, we can either place them in three of the eight spaces between two blue balls where we have already placed a red ball or we can place two of them in one of these eight spaces and place one of them in another of these spaces.  There are $\binom{8}{3}$ ways to select three of the spaces.  In each such space, we can place a green ball to the left or right of the red ball that is there.  There are eight ways to select a red ball to be surrounded by two green balls, seven ways to choose the other red ball that will be adjacent to a green ball, and two ways to choose on which of that red ball to place the green ball.  Hence, there are
$$\binom{10}{8}\left[\binom{8}{3}2^3 + \binom{8}{1}\binom{7}{1}\binom{2}{1}\right]$$
such distributions.
The eight red balls are placed in seven of the ten spaces between two blue balls: There are $\binom{10}{7}$ ways to select which seven of the ten spaces between two blue balls will receive at least one red ball and seven ways to select which of these spaces will receive two red balls.  To ensure that the blue balls are separated, we must place a green ball in each of the remaining three spaces between two blue balls.  To ensure that the two adjacent red balls are separated, we must place a green ball between them.  That leaves one green ball to distribute.  To ensure the green balls are separated, it must be placed in one of the seven spaces between two blue balls that already contains at least one red ball.  It can be placed in the same space that already contains two red balls separated by a green ball in two ways, so that the order is grgr or rgrg as we proceed clockwise from the blue ball with Adam's name on it.  Otherwise, it can be placed in one of the six spaces containing a single red ball.  In that space, it can be placed to the left or right of the red ball that is already there.  Hence, there are
$$\binom{10}{7}\binom{7}{1}\left[\binom{2}{1} + \binom{6}{1}\binom{2}{1}\right]$$
such distributions.
Thus, there are
$$\binom{10}{8}\left[\binom{8}{3}2^3 + \binom{8}{1}\binom{7}{1}\binom{2}{1}\right] + \binom{10}{7}\binom{7}{1}\left[\binom{2}{1} + \binom{6}{1}\binom{2}{1}\right]$$
ways to place ten blue balls, eight red balls, and five green balls in a circle up to rotation.
Placing Adam in the position of the blue ball with his name on it, we can place the remaining nine people in blue shirts in the positions occupied by the remaining blue balls in $9!$ ways, the eight people in red shirts in $8!$ ways, and the five people in green shirts in $5!$ ways as we proceed clockwise around the table from Adam.  Hence, the ten people in blue shirts, eight people in red shirts, and five people in green shirts can be arranged around the table in
$$9!8!5!\left\{\binom{10}{8}\left[\binom{8}{3}2^3 + \binom{8}{1}\binom{7}{1}\binom{2}{1}\right] + \binom{10}{7}\binom{7}{1}\left[\binom{2}{1} + \binom{6}{1}\binom{2}{1}\right]\right\}$$
ways.
