Looking for answers? Westonci.ca is your go-to Q&A platform, offering quick, trustworthy responses from a community of experts. Discover solutions to your questions from experienced professionals across multiple fields on our comprehensive Q&A platform. Get precise and detailed answers to your questions from a knowledgeable community of experts on our Q&A platform.

An ‘in shuffle’ is a perfect riffle shuffle on a standard deck of 52 playing cards - that just means a shuffle by splitting the deck in half, then interleaving cards, starting with the top half. Can you write a quick program to solve the following?

What is the position of the first card after the 7th shuffle?
How many times must you perform the shuffle so that the top card becomes the bottom card?
When do the first and last cards in the deck touch?
Finally, about how much time did you spend on this problem?


Sagot :

(a) The position of the first card after the 7th shuffle is; 22.

(b) The number of times you must perform the shuffle so that the top card becomes the bottom card is; 26 shuffles.

(c) The first and last cards first touch when the top card is in position 26 after 25 shuffles while the bottom card is in position 27 after 25 shuffles. Thereafter, they will touch again after the 51st shuffle.

Shuffling a Pack of Cards

Since the standard deck of cards has 52 playing cards, then we can assume that the shuffling occurs in a manner such that card number 26 which is the bottom card of the top half of the deck is now the bottom card of the overall standard deck of 52 playing cards.

From the above assumption, it means that card 27 which is the top card of the bottom half now becomes card 1 which is the top card and as such the sequence of card 1 positions with successive shuffles is now;

{2, 4, 8, 16, 32, 11, 22, 44, 35, 17, 34, 15, 30, 7, 14, 28, 3, 6, 12, 24, 48, 43, 33, 13, 26, 52, 51, 49, 45, 37, 21, 42, 31, 9, 18, 36, 19, 38, 23, 46, 39, 25, 50, 47, 41, 29, 5, 10, 20, 40, 27, 1}

From the above, we can deduce that after the first shuffle, card 1 will be at position 2;

After the second shuffle, card 1 will be at position 4 e.t.c

(a) From the above quick program, we can say that the position of the first card after the 7th shuffle is 22.

(b) From the above combination program, we see that the number of times you must perform the shuffle so that the top card becomes the bottom card is 26 shuffles.

(c) The first and last cards first touch when the top card is in position 26 after 25 shuffles while the bottom card is in position 27 after 25 shuffles. Thereafter, they will touch again after the 51st shuffle.

Read more about shuffling a pack of cards at; https://brainly.com/question/6819029