TITLE: Probability that shuffled deck contains no two consecutive cards of the same suit
QUESTION [5 upvotes]: If a deck of 52 standard cards is completely randomly shuffled, what are the odds that not once do two cards of the same suit end up right next to each other?
Rephrasing:
If I have a bag of 13 red balls, 13 blue balls, 13 yellow balls, and 13 white balls, and I keep pulling out balls without replacement, then what are the odds that I never pull a ball of the same color twice consecutively?
I've tried doing this for small sets, and looking for a rule (2 of each suit, and 3 of each suit)
I've tried to find a statistical significance to get a good estimate, or a certain pdf, or cdf to use, but I could find none.
Is there any way of finding this without massive computations?

REPLY [8 votes]: It's not that massive a computation.  Let $Q(a,b,c,d)$ be the probability that the top card isn't the first suit and no two adjacent cards share a suit, given that there are $a$ cards of the first suit left in the deck, $b$ of the second, etc., and the deck is thoroughly shuffled.  Then the probability you want is $Q(12,13,13,13)$ (having drawn the top card and identified its suit, whatever it was, as the "first suit").  The recursion is
$$
Q(a,b,c,d)=\frac{bQ(b-1,a,c,d)+cQ(c-1,a,b,d)+dQ(d-1,a,b,c)}{a+b+c+d},
$$
with boundary condition $Q(0,0,0,0)=1$.  The following Python code calculates the value for any values of $a,b,c,d$:
def q(a,b,c,d,cache={(0,0,0,0):1.0}):
  if a<0: return 0.0
  if (a,b,c,d) in cache: return cache[(a,b,c,d)]
  sm = (b*q(b-1,a,c,d) + c*q(c-1,a,b,d) + d*q(d-1,a,b,c)) / (a+b+c+d)
  cache[(a,b,c,d)] = sm
  return sm

Once defined, q(12,13,13,13) returns 1.1817474309603094e-06 almost instantly.