We have 3 pairs of socks. If I hang them on a wire to dry what's the probability that no socks of either pair hangs next to each other? Let's say we have $n$ pairs of different objects, indistinguishable within either pair and we place them in a row. What's the probability that no objects of either pair are placed next to each other?
E.g. for $n=3$ we count 123213 as success and 123312 or 112332 as failure.
I tried to find a solution for a rather long time. The best thing came to mind for $n=3$ is:
 1. First we find the total number of variants -- it's easy $\frac{(2n)!}{(2!)^n}=\frac{720}{8}=90$
 2. Then we find the number of variants if only $1$ pair of objects are next to each other, then we can say the pair is a new object and we can insert it into an arbitrary position within the rest -- $n\frac{(2n-2)!}{2^{n-1}}(2n-2+1)=90$, but we did count here variants with $2,\,3,\,\dots$ neighboring pairs, let's subtract them after we get them calculated then.
 3. For $2$ neighboring pairs we have $2n-4$ objects of the first type and $2$ objects of the second type (i.e. pairs) so there are ${n\choose 2}\frac{(2n-2)!}{2^{n-2}}=36$ variants but we did count $3$ and more pairs here too so we'll subtract them later.
 4. $\dots$ for $n$ neighboring pairs we have $n!=6$ variants.  


*For $n=3$ only $n-1=2$ pair variants are then $36-3\cdot 6=18$ as we did count $3$-pair variants within $2$-pair variants ${n\choose n-1}=n=3$ times for each of $n$ (pairs).  

*And there must be $36$ variants for only $1$ neighboring pair according to the python program  

*So the answer is $30$ and the probability $=\frac{1}{3}$
The question is -- is there a neater solution or at least what do I have to know to be able to approach the problem?
Thanks
 A: You've got the right idea.  You want to use the principle of inclusion and exclusion. 
We have $2^{-n}(2n)!$ ways to arrange the objects.  We want to subtract the arrangements with two identical objects adjacent.  There are $\binom n1$ ways to select which pair will be adjacent and then $2^{1-n}(2n-1)!$ ways to arrange the objects.  However, each arrangement with two adjacent pairs has been subtracted twice, so we have to add them back in.  Now we have $\binom{n}{2}$ ways to select which pairs will be adjacent and $2^{2-n}(2n-2)!$ ways to arrange the objects.  The arrangements with three adjacent pairs have been subtracted three times and added back in three times, so we have to subtract them, and so on.  Continuing, the number of arrangements with no adjacent pairs is $$\sum_{k=0}^n(-1)^k\binom{n}{k}2^{k-n}(2n-k)!$$ 
With $n=3$ we get $$\frac{6!}{8}-\frac{3\cdot5!}{4}+  
\frac{3\cdot4!}{2}-\frac{3!}{1}=90-90+36-6=30$$
EDIT
Note this is sequence A114938 in OEIS.
P.S.
It turns out that as $n\to\infty$, the probability goes to $\frac1e$.
