Ways to arrange 4 different colour balls with no two of the same colour next to each other I have n green balls, n blue balls, m red balls, m yellow balls.
How many ways are there to arrange this such that we don't have an sequence with 2 of the same colour next to each other?
I don't know how to begin even formulating an answer. Any guidance would be appreciated.
 A: Sure.  Just alternate the two colors with $n$ each, then alternate the two with $m$ each.
A: One simple way to do this is to write down a recurrence.  For nonnegative integers $g,b,r,y$ and a color $c$, let $f(g,b,r,y,c)$ be the number of ways to arrange $g$ greens, $b$ blues, $r$ reds and $y$ yellows, with no two consecutive colors in a row, where the last ball has color $c$.  Then you have
$$f(g,b,r,y,\mathrm{green})=\sum_{c\ne\mathrm{green}}f(g-1,b,r,y,c)$$
and an analogous expression for the other colors.  The initial conditions are
$$f(1,0,0,0,\mathrm{green})=f(0,1,0,0,\mathrm{blue})=f(0,0,1,0,\mathrm{red})=f(0,0,0,1,\mathrm{yellow})=1$$
together with $f(0,0,0,0,c)=0$.
Having computed these values, the number of ways to arrange the balls with no restriction on the last ball is just
$$f(g,b,r,y) =\sum_{\mathrm{colors\ }c}f(g,b,r,y,c).$$
You probably also want to set $f(0,0,0,0)=1$ to count the empty arrangement, even though it doesn't feed into the recurrence as I've set it up.
If I've done this correctly, the following are the values for $0\le m,n\le 5$.
$$\begin{array}{c|cccccc}
 & 0 & 1 & 2 & 3 & 4 & 5\\
 \hline
 0&1 & 2 & 2 & 2 & 2 & 2 \\
 1&2 & 24 & 84 & 184 & 324 & 504 \\
 2&2 & 84 & 864 & 4204 & 13464 & 33516 \\
 3&2 & 184 & 4204 & 41304 & 235804 & 941848 \\
 4&2 & 324 & 13464 & 235804 & 2265024 & 14204940 \\
 5&2 & 504 & 33516 & 941848 & 14204940 & 134631576 \\
\end{array}
$$
The row with $m=0$ makes sense, as you only have $2$ colors and you must alternate them.  Row $1$ is twice the sequence A005901 in OEIS, which counts the number of points on the surface of a cuboctahedron or an icosahedron. This can be proved from the recurrence but it's not immediately clear to me combinatorially why this should be so.
