Calculating the number of permutations that do not have at least one set of duplicate elements adjacent. Ok, so I've got a set of elements, some are duplicates but each are considered unique as far as set-making goes.  I need to find how many permutations exist that do not put two of the duplicates next to each other, (for example, if the set were $\{blue, blue, green, red\}$ then I would like to know how many permutations exist that do not put the two blues adjacent to one another).
Now the trickier parts: there can be any number of duplicates of any element, so this would have to account for sets such as: $\{blue, blue, blue, red, red\}$ and $\{blue, blue, blue, blue\}$ and $\{blue, blue, green, green, green, red, red\}$.  The goal is to find how many permutations there are where no two similar elements are adjacent.
This is as far as I have gotten: given an example set of $\{blue, blue, blue, red, red\}$, the number of permutations where a given element $blue$ is adjacent to another $blue$ is given by the equation $(N - 1)!\frac{blues!}{(blues - 2)!}$ and the intersection of the set of permutations where $blue$ is adjacent to $blue$ and the set of permutations where $red$ is adjacent to $red$ is: $(N - 2)\frac{blues!}{(blues - 2)!}\frac{reds!}{(reds - 2)!}$ and generalizing that out to read: the intersection of $i$ sets of permutations that have adjacent colors is:
$$(N-i)!\prod_{x=0}^i\frac{colors_x!}{(colors_x - 2)!}$$
Using that generalization and the inclusion-exclusion principle, I have come to an equation
$$nonadjacent = N! + \sum_{i=0}^{a} (-1)^{i}(N-i)!\prod_{x=0}^{i}\frac{colors_{x}!}{(colors_{x}-2)!}$$
where $a$ equals the number of different colors that have two or more duplicates.
This equation works perfectly as long as no individual color has more than two duplicated elements.  What am I missing to make this equation work properly?
 A: The general case seems rather intractable, but I'll do a manageable example to give you an idea.
Say you have $4$ red elements and $3$ blue elements, and the remaining $N-7$ elements are unique.
You've already worked out the first steps. The total number of permutations is $N!$. The number of permutations that violate the condition that no two red elements be adjacent is $(N-1)!\cdot4\cdot3$, since there are $4\cdot3$ ordered pairs of red elements and $N-1$ objects to order ($N-2$ remaining elements and $1$ pair). Likewise for blue we get a contribution $(N-1)!\cdot3\cdot2$.
You've also already started to take multiple condition violations into account, but only for the case of at most one pair of each colour. The corresponding contribution in this case is, as you found, $(N-2)!\cdot4\cdot3\cdot3\cdot2$, since we can choose an ordered red pair and an ordered blue pair and then order $N-2$ objects ($N-4$ remaining elements and $2$ pairs).
To count the number of ways that two blue pair violations can occur, note that, since we only have $3$ blue elements, this can only happen if they all appear in a row. They can do so in $3!$ different orders, and we are then left with $N-2$ objects to order ($N-3$ remaining elements and $1$ triplet), for a contribution of $(N-2)!\cdot3!$.
For the red elements, things are slightly more complicated. We get the same contribution for triplets with an extra factor of $\binom43=4$, since we have $4$ red elements from which to choose the $3$ in the triplet, for a contribution of $(N-2)!\cdot3!\cdot4$.
But since we have $4$ red elements we can also violate two pair conditions with two separate pairs. There are $\frac{4!}2$ ways to distribute the $4$ red elements over the two pairs (since order matters within the pairs but not between the pairs, as that will be taken into account in the factor $(N-2)!$), and then we're left with $N-2$ objects to permute ($N-4$ remaining elements and $2$ pairs), for a contribution $(N-2)!\cdot\frac{4!}2$.
To violate $3$ adjacency conditions, we can either violate three red ones, two red ones and one blue one or one red one and two blue ones. I’ll just write down the results without much further explanation; the basic idea is the same as for simpler cases above.
If three red adjacency conditions are violated, all four red elements are consecutive, for a contribution $(N-3)!\cdot4!$. Violating two red and one blue conditions yields $(N-3)!\cdot3!\cdot4\cdot3\cdot2$ for a red triplet and $(N-3)!\cdot\frac{4!}2\cdot3\cdot2$ for two red pairs. Violating one red and two blue conditions yields $(N-3)!\cdot4\cdot3\cdot3!$.
For four simultaneous violations, violating $3$ red ones and $1$ blue one yields a contribution $(N-4)!\cdot4!\cdot3\cdot2$, and violating $2$ red ones and $2$ blue ones yields $(N-4)!\cdot3!\cdot4\cdot3!$ for a red triplet and $(N-4)!\cdot\frac{4!}2\cdot3!$ for two red pairs.
Finally, for five conditions to be violated simultaneously all red elements have to be consecutive and all blue elements have to be consecutive, for a contribution $(N-5)!\cdot4!\cdot3!$.
Summing it all up, we obtain
\begin{eqnarray*}
N!-(N-1)!(4\cdot3+3\cdot2)+(N-2)!\left(4\cdot3\cdot3\cdot2+3!+3!\cdot4+\frac{4!}2\right)\\-(N-3)!\left(4!+3!\cdot4\cdot3\cdot2+\frac{4!}2\cdot3\cdot2+4\cdot3\cdot3!\right)+\\(N-4)!\left(4!\cdot3\cdot2+3!\cdot4\cdot3!+\frac{4!}2\cdot3!\right)-(N-5)!\cdot4!\cdot3!)
\\[10pt]
=N!-18(N-1)!+114(N-2)!-312(N-3)!+360(N-4)!-144(N-5)!
\;.
\end{eqnarray*}
We can write this all down more succinctly if we denote by $a_{j,k}$ the number of ways to choose elements for $j$ violations of adjacency conditions of colour $k$; then the inclusion–exclusion sum is
$$
\sum_{n_1,\ldots,n_m}(-1)^{\sum_in_i}\left(N-\sum_in_i\right)!\prod_ka_{n_k,k}\;.
$$
