Number of $2n$-letter words using double $n$-letter alphabet, without consecutive identical letters How many words with $2n$ letters can be created if I have an alphabet with $n$ letters and each of the letters have to occur exactly twice in the word, but no two consecutive letters are equal?
Thanks!
 A: There is no simple closed formula for this (I think no known closed formula at all), but one can give a formula as a sum by using inclusion-exclusion.
First consider such orderings where the pairs of identical letters are distinguishable.  Then $\displaystyle \sum_{k=0}^n (-1)^k2^k(2n-k)!\binom{n}{k}$ gives the number of such such orderings by inclusion-exclusion (there are $(2n-k)!$ ways for $k$ given pairs to be together (by merging the those pairs into single elements) and the rest arbitrarily ordered, $2^k$ ways to order within those given pairs, and $\binom{n}{k}$ ways to pick those $k$ pairs). By dividing by $2^n$ to eliminate the ordering of pairs of identical elements we can obtain the formula $\displaystyle \frac{1}{2^n}\sum_{k=0}^n (-1)^k2^k(2n-k)!\binom{n}{k}$.
A: As pointed out in the comments, this sequence appears in the OEIS (A114938), and is a special case of a more general result found elsewhere on this site (e.g., here and here).
The OEIS gives the result as a sum:
$$
A_{n}=\sum_{k=0}^{n}\frac{(-1)^{n-k}(n+k)!}{2^k}{{n}\choose{k}}\\=\frac{1}{2^n}\sum_{k=0}^{n}(-2)^k(2n-k)!{{n}\choose{k}},
$$
where the second version is obtained from the first by changing $k\rightarrow n-k$ in the summation.  To derive this from the more general expression, we write
$$A_{n}=\int_0^\infty (q_2(x))^n \, \exp(-x)\,dx,$$
where $$q_2(x) = \sum_{i=1}^{2} \frac{(-1)^{2-i}}{i!} {2-1 \choose i-1}x^i=\frac{1}{2}x(x-2);$$
so
$$
A_n=\frac{1}{2^n}\int_{0}^{\infty}x^n(x-2)^ne^{-x}dx=\frac{1}{2^n}\sum_{k=0}^{n}(-2)^k{{n}\choose{k}}\int_{0}^{\infty}x^{2n-k}e^{-x}dx,
$$
where the binomial expansion was applied to $(-2+x)^n$.  Since one can readily check that $\int_{0}^{\infty}x^a e^{-x}dx=a!$ (by repeated integration by parts, for instance), the two expressions coincide.
A: We have 2n positions to fill, lets fill two positions with one letter.
We have n pairs of double letters.
For the first pair of double letters we have (2n-2)(2n-3) possible positions. This is because first we put the letter on a position not on the sides, and the other letter on the remaining positions that are not next to our letter. 
[edit] Now we proceed for the next letter: We have 2n-2 positions left to fill with another letter, use the above procedure. 
Keep doing this, in total n times, to get all words. It works because it doesnt matter where we place one letter (and his double) for the other letters. 
[EDIT] I have forgotten one thing:The words of the form a _ _ _ a.
Adding them we get:
For n to 0 get the product of:
(2n-2)(2n-3)
And add to this :
n times 'For n-1 to 2 get the product of:
(2n-2)(2n-3) '
This gives for n=3 : 30 words.
For n=4 : 840
A: first of all if you want to find the number of words in which no two same letters are equal then it is equivalent to finding
the total number of words that can be made with the letters minus the number of  words in which consecutive letters are present.
you can easily find the total words that can be made with the letters to be $$\frac{2n!}{(2!)^n}$$
now to find the no. of words that in which letters are consecutive.
initially consider a pair $xx$ is formed in the word with no other same elements consecutive. Consider the set $xx$ as a single element which is free to traverse to any position between the remaining $2n-2$ elements.
then the set $xx$ can be placed in any of the available $2n-1$ positions.
At the same time the remaining $2n-2$ elements can itself be rearranged $\frac{(2n-2)!}{(2!)^{n-1}}$
therefore the total no. of ways a pair of letters can become consecutive is
$$\frac{(2n-2)!*(2n-1)}{(2!)^{n-1}}$$
$$= \frac{(2n-1)!}{(2!)^{n-1}}$$
now extend this for more number of sets from $1$ to $n$. 
you will find the final answer for
as $k$ runs  from $1$ $\to$ $n$ is
$$ \frac{2n!}{(2!)^n}-\sum \frac{(2n-k)!}{(2!)^{n-k}}$$
A: My answer is similar to suraj's, however, I will explain a few nuances below:
${(2n-r)!}$ : in the numerators are derived from remove two of the same letters, and adding them back into the sequence as one combined letter. The arrangements of these combined letters (among themselves) do not matter because they are the same.
$\binom{n}{r}$ : is representative of how many letter pairs we are assuming will be together.
answer  = $\frac{(2n)!}{2!^{n}} - \binom{n}{1}\frac{(2n-1)!}{(2!)^{n-1}}\ \ \  + ... + \ \ (-1)^{r}\binom{n}{r}\frac{(2n-r)!}{(2!)^{n-r}}\   \ \ \ \ +...+ \ \ (-1)^{n}\binom{n}{n}\frac{(2n-n)!}{(2!)^{n-n}}$
I have programmed this in python, and have tested that $n = 3$ returns 30. Below is the pasted code in python:
import math

def nCr(n,r):
    f = math.factorial
    return f(n) / f(r) / f(n-r)

def compute(n):
    total = math.factorial(2*n)/(2**n)
    sum = 0
    for i in range(1,n+1):
        choice = nCr(n,i)
        sign = (-1)**i
        numerator = math.factorial(2*n - i)
        denominator = 2**(n-i)
        sum += choice * sign * (numerator/denominator)
    return total + sum

print(compute(3))

