# Count Permutations / Probability of Specified 52 Card Sequence - Starting Over After Any Failure?

#### dial911book

##### New member
Thank you for helping with this, I have an educated guess how to do it but would really appreciate an expert's input. Start with a 52 card standard deck. I write on a piece of paper one long sequence that accounts for all 52 cards. To visualize, I write 2C, 4H, 6D, 8S, AC, KH, 9H, … all the way through. So I know what the target sequence is.

Now -- another person starts dealing out one card at a time from a shuffled 52 card deck. The first card is, say, 5C. Oops - 5C is not the correct first card in my predefined sequence. So she puts the card back in the deck, shuffles, and deals out a 2C. Fine, that matches the predefined sequence. She deals at random the next card. Oops, it is a 10S. So she takes both of the cards back into the deck, shuffles, and starts over.

Question: How many of these deals, where there is no guarantee that the first or second or third … or 51st card, will be the correct one in the sequence -- and whenever the wrong card comes into the sequence she is dealing, she takes all of the cards back, shuffles, and starts again -- would be expected to occur (on average) to obtain all 52 card dealt out in the specified order without a reshuffling?

(If you can show how you made the calculation, that will greatly help me, so I can generalize to other related sorts of problems.)

(If it is simpler to show how it is done for, say, 5 distinct cards, that's fine, if I can generalize the formula )

(It occurs to me that the solution is a number much larger than 52!, which is the number of discrete arrangements of all 52 cards. I just don't know how to think about the problem of restarting from scratch when the sequence is part way but then fails.)

-Richard

#### pka

##### Elite Member
Question: How many of these deals, where there is no guarantee that the first or second or third … or 51st card, will be the correct one in the sequence -- and whenever the wrong card comes into the sequence she is dealing, she takes all of the cards back, shuffles, and starts again -- would be expected to occur (on average) to obtain all 52 card dealt out in the specified order without a reshuffling?
(If you can show how you made the calculation, that will greatly help me, so I can generalize to other related sorts of problems.)
(If it is simpler to show how it is done for, say, 5 distinct cards, that's fine, if I can generalize the formula )
(It occurs to me that the solution is a number much larger than 52!, which is the number of discrete arrangements of all 52 cards. I just don't know how to think about the problem of restarting from scratch when the sequence is part way but then fails.)
This is an example to a question written by not just how big numbers can get.
Suppose one does list out all fifty-two cards in a deck. The a well shuffled deck is made.
There are 2.9672484407795138298279444403649511427278111 × 10^67(the decimal place is moved 67 places to the right) deals in which there are no matches.

So let's consider just ten cards numbered $$\displaystyle 0,1,2,\cdots,9$$. Shuffle the cards well.
Now you list those ten digits in any order you wish.
How many ways do you think can the ten snuffled cards be dealt out one by one with no matches.
Well it is about 1,334,960. That in no matches. 10!=3,628,100 is the total possible. So about one-third have no matches.
Under your scheme returning cards after a non-match over complicates the numbers.

Can you rewrite the question? Maybe with say four matches or more total in ten cards.

#### dial911book

##### New member
Thank you, pka, for taking a look at this problem. I'm thinking that my explanation was not clear enough. Yes, 52! tells us how many different ways to lay out the 52 cards in a sequence.

My problem is to see how many Attempts it would take, or would be likely to take, to get a specific order of the cards that I chose in advance -- if the process had to start all over at the moment one of the cards in the sequence of chosen cards did not match the pre-chosen sequence.

For the first card, there are 51 ways to pick the wrong card. And you start over with that card again until one time it is correct.

If you get the first card correct, then there are then 51 ways to pick the wrong card for the second one in the sequence. For each of these 51 ways, you have to start over, and select at random from the shuffled deck to pick the first card again.

You know, if we knew how to calculate this for even 5 cards in a sequence, we'd have the method that I could then generalize up to however many cards I want.

An easier way to think of it maybe. Suppose we have letters A,B,C,D,E.
I choose the sequence E,B,C,A,D in advance.

Now we try:
B
Nope, try again.
C
Nope, try again,
E
Good now try the second card from those remaining.
E, A
Nope, start over.
C
Nope, try again.
E
Good now try the second card from those remaining.
E,B
Good now third card.
E,B,A
Nope, start all over.

Maybe the solution is an algorithm not reducible to a formula, it just occurred to me.

#### pka

##### Elite Member
You know, if we knew how to calculate this for even 5 cards in a sequence, we'd have the method that I could then generalize up to however many cards I want.
An easier way to think of it maybe. Suppose we have letters A,B,C,D,E.
I choose the sequence E,B,C,A,D in advance.
Now we try:
B
Nope, try again.
C
Nope, try again,
E
Good now try the second card from those remaining.
E, A
Nope, start over.
C
Nope, try again.
E
Good now try the second card from those remaining.
E,B
Good now third card.
E,B,A
Nope, start all over.
But now you have changed the game! Originally you said that if the first did not match then there is a total reset.
Once again, with five cards there are 44 ways that there are no matches period! Much less the first card match.
You have written that i the first cards do not match then reshuffle. Do you want to change the game?

#### dial911book

##### New member
I did not change the game. You may be misunderstanding the problem. I am not sure how to present it differently to make it clear to you, I'm sorry. Thank you for giving it a try.

#### dial911book

##### New member
Oh - my bad - I see -- when I gave my second numerical example, I said the second card had 51 ways of being wrong. That was an error. It is 50 ways to be wrong, because the first card has been chosen. I can see why you thought I had changed the problem. No, that was just my not remembering there were only 51 cards left in the deck at the point of the second card. One would be the correct second card, the other remaining 50 would be wrong. Does that help?