# How many arrangements of a (generalized) deck of (generalised) cards have pairs in them?

Consider a generalized deck of $n$ cards. That is, $n$ objects (generalized cards) characterized by a pair of discrete indices: $(i,j)$, where $i$ is the rank and $i=1,\dots,R$ and $j$ is the suit and $j=1,\dots,S$.

For a regular deck we have $R=13$ (Ace to King) and $S=4$ (Spades to Hearts). In addition we consider a $T$-"tuple" of cards with $T \leq S$. A $T$-tuple is $T$ (or more) cards of the same rank (same i index) in a row within the shuffled deck.

Question: How many arrangements of these cards n have $T$-tuples in them?

intuitive: My question originated from the special case of a regular deck and $T=2$ i.e. pairs. How many arrangements of the $52$ cards have no pairs in them? (and from there one can easily calculate the probability of finding no pairs in a shuffled deck) for example a shuffled deck that goes like 8 3 7 4 6 7 5 4 K Q K K ...etc hits a pair in the last 2 cards

-
What do you mean by an "arrangement" having "a pair." Does that meant that two consecutive cards in the arrangement have are the same denomination? –  Thomas Andrews Jun 26 '13 at 13:53
For pairs the answer is here: math.stackexchange.com/questions/310971/… –  Byron Schmuland Jul 20 '13 at 23:54

Jair Taylor's wonderful answer to this MSE question shows you how to find the number of arrangements of the $n$ cards without pairs. The answer is $$\int_0^\infty (q_S(x))^R \, \exp(-x)\,dx,$$ where $q_S$ is the polynomial $q_S(x) = \sum_{i=1}^S \frac{(-1)^{i-S}}{i!} {S-1 \choose i-1}x^i$.
When $S=4$ and $R=13$ the number of pair-free arrangements is $$\int_0^\infty q_4(x)^{13} \, \exp(-x)\,dx =4184920420968817245135211427730337964623328025600$$ and the corresponding probability is about $.045476$.
For sequences of a different length, say triples, you need to replace the $q$ functions with other polynomials. You can even mix things up, and forbid patterns of different lengths for different values, e.g. no face cards occur in pairs, aces and twos cannot occur in triples, but otherwise no restrictions.