# Any Volunteers for Card Counting?

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?

• 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.) Jun 13, 2019 at 15:16
• @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. Jun 13, 2019 at 15:20
• @Uvc For the second case, if you have already removed a card from the bottom deck what is the distance to this card? Jun 13, 2019 at 15:31
• If it cannot be done, you can say so.
– Uvc
Jun 13, 2019 at 15:32

I think that in the first case the total sum is

$$36 \times 36 = 1296$$

Reasoning

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$$.