You are given 2 matching card decks with Aces, Kings, Queens, Jacks removed. Now each deck has 36 cards.

One deck is shuffled and placed on top of the other deck. Starting from the top card, you count the number of cards between it and the corresponding card of the second deck. Continue the process for all cards of the top deck.

What is the total Sum?

For the second case, you do the same process except you remove top card of top deck and bottom card of bottom deck after each count.

What is the total sum for this second case?

Please provide details of your reasoning.

  • $\begingroup$ unless i misunderstand: rot13(vs lbh fgnpx gur qrpx fhpu gung nyy nyvxr pneqf ner gbtrgure, gura gur fhz vf 36. Nal bgure neenatrzrag vapernfrf gur fhz, fb vg qbrfa'g frrz yvxr gur fhz vf pbafgnag.) $\endgroup$
    – SteveV
    Jun 13, 2019 at 15:16
  • $\begingroup$ @SteveV The two decks are not shuffled with each other. Thus at most one pair of identical cards can be side-by-side: The bottom card of the top deck, and the top card of the bottom deck. $\endgroup$ Jun 13, 2019 at 15:20
  • $\begingroup$ @Uvc For the second case, if you have already removed a card from the bottom deck what is the distance to this card? $\endgroup$
    – hexomino
    Jun 13, 2019 at 15:31
  • $\begingroup$ If it cannot be done, you can say so. $\endgroup$
    – Uvc
    Jun 13, 2019 at 15:32

1 Answer 1


I think that in the first case the total sum is

$36 \times 36 = 1296$


Suppose we take two cards in the top deck at positions (counting top down) $i$ and $j$ such that $j-i = d$. Additionally, let the number of cards between each of these and their partners in the bottom deck be $d_i$ and $d_j$, respectively. Suppose we switch cards $i$ and $j$. Then, the number of cards between each card and their partner now becomes $d_i-d$ and $d_j+d$, respectively.
Notice that the overall sum of these two values is unchanged and, consequently, the corresponding sum for all cards is invariant under the switching of any two cards. Any shuffling of the top deck can be achieved by a succession of switches. Hence, the sum is invariant under shuffling. It remains to compute it in just one case. In particular, if the top and bottom decks are in the same order, then each card in the top deck will be at distance $36$ from its partner in the bottom deck.

For the second case

It may be that you have already removed a card from the bottom deck before you find the corresponding card in the top deck so I don't know how the distance would be computed in that case.
I think the only scenario here where you always find the matching cards in the remaining deck is when the top deck is the reverse of the bottom deck (this can be easily seen by starting at the end of the process and working backwards). In this case, the sum will be the same as before, $1296$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.