I tried to solve following task:
Count number of $8$-permutations from $2$ letters $A$, $2$ letters $B$, $2$ letters $C$ and $2$ letters $D$ where exactly one pair of same letters are adjacent in resulting permutation
My solution is straightforward: let $A_i$ be the number of permutations with at least $i$ pairs of same letters adjacent, then our solution will be $A_1 - A_2 + A_3 - A_4$ $$A_1=\binom{4}{1}\times 7 \times 1! \times \frac{6!}{2^3}$$ $$A_2=\binom{4}{2}\times 15 \times 2! \times \frac{4!}{2^2}$$ $$A_3=\binom{4}{3}\times 10 \times 3! \times \frac{2!}{2^1}$$ $$A_4=\binom{4}{4}\times 1 \times 4! \times \frac{0!}{2^0}$$ My logic is following: first take $i$ pairs of same letters that for sure gonna be adjacent, then count number of possibilities to place those pairs in permutation (i used recurrence relation $f(n,k)=f(n-1,k)+f(n-2,k-1)$ to count number of ways to put $k$ $2$-blocks in $n$-block line), then we can permute those pairs $i!$ times, lastly we permute rest of the letters in $\frac{(8-2i)!}{2^{4-i}}$ ways.
Result of this is $1656$ and correct result (according to my computer program) is $984$, so it seems i'm hugely overcounting something, but i have no idea what.
I'd appreciate some help on this.
There are $7!/2^3=630$ permutations with a pair of adjacent letters A.
There are $6!/2^2=180$ permutations with a pair of adjacent letters A and a pair of adjacent letters B. Same for A and C, and for A and D.
There are $5!/2=60$ permutations with a pair of adjacent letters A and a pair of adjacent letters B and a pair of adjacent letters C. Same for A and B and D, and for A and C and D.
There are $4!=24$ permutations where all letters occur as adjacent pair.
So there are $630-3\times 180+3\times 60-24=246$ permutations that have a pair of adjacent letters A and no other adjacent pair of letters.
So there are $4\times 246=984$ permutations that have exactly one pair of adjacent letters.