Suppose you arrange some cards from a standard 52-card poker deck with the following conditions:
What is the maximum number of cards that can be arranged like this?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
S1 H1 --> H2 C2 --> C1 D1 --> D2 S2 --> S3 H3 --> H4 C4 --> C3 D3 --> D4 S4 --> S5 H5, etc... Its possible to continue this to number 52 and beyond
Log in to reply
No, it is not.
Try writing it out all the way and you will find that you are stuck when you get to the 50th card. If the deck had 56 cards you could do it, but with a standard 52 card deck you can't.
Log in to reply
There is no requirement in the problem specification that the arrangement cannot be a cycle
Log in to reply
Log in to reply
@Nisse Que – It doesn't buy anything
Imagine there were only 3 cards (an odd number) in each suit. What would you do when you got to S3 H3? If there were no H4, you could not extend the sequence and get back to C3 D3. A similiar problem happens with the odd number 13 cards in a suit.
I thought i could do it for 51 cards. What is wrong with this sequence or what am I leaving out besides one queen? (AS, AH), (2H, 2S), (3S, 3H)...(QH, QS) = 24 cards. Now, don't play KS, KH or we'd be stuck, so we go KS, KD, 26 cards. Rinse and repeat. (AD, AC), (2C, 2D), (3D, 3C)...(JD, JC) = 22 additional cards. 4 left. So play QC, KC, KH (left over from the first pass through) = 51 cards, leaving only the QD.
Log in to reply
JC QC KC is three clubs in a row.
Log in to reply
Yep. I work these things in my head in the middle of the night, and finally, this morning about 2a, I noticed that. O well. I’ve demonstrated how to do it with 50 as you all have proved with two kings left over.
Log in to reply
@Bob Ewell – Yes, that happens to me too. :)
Nice explicit solution.
think about a 4x13 table, starting from one grid, how many grids can you go through(take a turn with every step)
Probably 52
Using graph theory approach:
Consider the complete bipartite graph K ( 4 , 1 3 ) . Each card can be represented by an edge of the graph, since each card matches one of 4 suits with one of 13 ranks. So arranging of the cards using the condition is equivalent to find an Eulerian trail to it.
Note that K ( 4 , 1 3 ) has 4 vertices with odd degree. Let G be the graph obtain from K ( 4 , 1 3 ) by removing two adjacent edges ( a , b ) and ( a , c ) where the degree of a (in G ) is 2 while the degree of b and c (in G ) are 12, then G will have only 2 vertices with odd degree and thus G is a semi-Eulerian. So it is possible to have a trail containing all edges in G .
Thus 5 2 − 2 = 5 0 cards is the longest possible sequence.
p/s: I made a video on discussion on this matter, one method discussed is similar to @Varsha Dani .
Wow! What was the thinking process for arriving at this solution?
Any line of cards satisfying the conditions can be divided into pairs of equal suit with potentially one card at either end which is not part of an equal suit pairing (as per the illustration.) Since there are 13 cards in a suit which can be matched into pairs with one left over, the single cards at each end can only account for two of the left over cards. There are always two cards which can't included.
To show that a solution with 50 cards is possible I offer the following: AC AD 2D 2C 3C 3D ... QD QC KC KH QH QS ... 2H 2S AS AH which includes every card except KD and KS.
To visualise the above solution, imagine a grid of four columns and thirteen rows. The solution zig-zags down the first two columns and back up the last two.
You can design an algorithm that works for this. Divide the deck into pairs of cards of the same value and each pair must have a matching pair of suits i.e. 2 Ks, 2Qs, 2Js, 2 10s, ... , 2As all suits for each pair Clubs and Spades. Then do the same with the remaining 26 cards, but this time the pairs will have suits, H and D. Now starting with the A of Clubs, put it next to its pair, A of Spades, and next to the A of S, place a 2 of S and repeat this pattern all the way up to the K of C (because their are 13 values in the deck). Something like: AC, AS, 2S, 2C, 3C, 3S, 4S ... QS, QC, KC. Take the other listed pairs and instead of placing a K of S next to the KC, place a KD. Take the remaining pairs from A to Q and repeat the pattern: QS, QC, KC, KD, AD, AH, 2H, 2D, .... QH, QD. Here is where we reach the problem, we cannot put down another K as we have already used the KD. So the answer is 50 as we cannot put down the remaining 2 cards. This is not a general solution, but it works.
We shall arrange all the 52 cards in four seprate rows, each row R i for a suit (Let the rows be sorted by rank: 2 , 3 . . . . J , Q , K , A ). Taking any arbitrary two rows , we start by 2 and continue for the 2 in the other suit and then for 3 in the corresponding suit and for 3 in the first suit. Following suit (no pun intended) you should reach ace in the end after you finished the two rows. Returning to the next two rows you'd observe that no matter how you put it, you cannot use the two other ace's, because they would force you to violate one of the conditions. Hence 52-2=50 :)
A->A->K->K->A->A->K->K->Q->Q->J->J->Q->Q->J->J->10->>> If poker cards would count from Rank 2 back to Ace all 52 card could be layed in a circle this way.
Except nothing would prevent you from using 2 and Ace one after the other... The only problem is the parity of the number of cards in each suit, since your line ends with 5->4->4->3->3->4->4->3->3->2->2. What prevents you from using Aces to reach the remaining two cards is the fact that you already USED the aces.
Why would this not work for a 52 card layout? This appears to me to satisfy every rule and uses all 52 cards. AS AC 2C 2H 3H 3D 4D 4S 5S 5C 6C 6H 7H 7D 8D 8S 9S 9C 10C 10H JH JD QD QS KS KC AH AD 2D 2S 3S 3C 4C 4H 5H 5D 6D 6S 7S 7C 8C 8H 9H 9D 10D 10S JS JC QC QH KH KD
Log in to reply
The problem is at going from KC to AH... Neither the value nor the suit are matching. :-B
Problem Loading...
Note Loading...
Set Loading...
Each card in the arrangement except the first and last cards must have two neighbors, one with the same suit, and one with the same rank. If each card is paired up with its neighbor with the same suit, then we have a matching on the cards in the arrangement (except the first and last). Since there are 13 cards in each suit, each suit must have one unmatched card. Of the four unmatched cards, one can be the first card, and another the last card, but that still leaves two cards that cannot be fit into the arrangement. Thus the maximum possible size of the arrangement is no more than 50 cards.
To complete the solution we must show that an arrangement with 50 cards can be achieved. However, it is easy to write down such an arrangement, for instance by cycling through the suits in a fixed order such as H, S, S, D, D, C, C, H, H, S, S, ..., H, H, S leaving one C and one D unmatched.