Counting solitaire

Arrangements, combinations and permutations, probability, ...
Post Reply
Posts: 10
Joined: Mon Mar 17, 2008 3:31 pm

Counting solitaire

Post by guana »

Using a single deck (52 cards) the rules of the solitaire game are as follows.

1. Draw a card, counting "one". Draw the next card, counting "two". Keep counting and drawing cards until you reach thirteen and start again from one. (1 = Ace, .. 11 = Jack, 12 = Queen, 13 = King)
2. If at any point the number you count matches the card drawn, the game is lost.
3. The game is won if you can count through the whole deck.

How many deck combinations out of 52! lead to a winning game in this game of solitaire?
Posts: 540
Joined: Sat Oct 17, 2009 10:39 pm

Re: Counting solitaire

Post by wrongrook »

Interesting problem to think about, I make the answer 1309302175551177162931045000259922525308763433362019257020678406144
using the Python code (0.03seconds):

Code: Select all

def derange_cards(J,C):
   if C==0: return J==0
   return sum(nCr(4,k)*nCr(4,j)*nPr(J,j)*nPr(J,k)*derange_cards(J-j+4-k,C-4) for j in range(min(4,J)+1) for k in range(min(4,J)+1))
print derange_cards(0,52)
I found it very helpful to consider placing all the cards of the same rank at the same time, and keep track of how many gaps I have left (J) in placing the cards so far. For each rank, j is how many gaps to fill in, and k is how many of the spare cards to use up.
Posts: 3
Joined: Tue Oct 14, 2014 5:09 am

Re: Counting solitaire

Post by TammaraBa23 »

Cool game. Best of luck everyone. :D
Check this amazing dream dictionary site which discusses different dreams, you can visit the dream site at dreamdictionarynow is has a dream dictionary a-z.
Post Reply