If you take a deck of 2n playing cards, cut it into two stacks of n and interleave them, you have performed a perfect shuffle.
Example: for the six-card deck [1 2 3 4 5 6]T , the result is [4 1 5 2 6 3]T (note that the top card of the second stack goes on top. Write down the matrix A2n for a perfect shuffle of 2n cards when 2n=10 and 2n=12. How many times must you (perfectly) shuffle a deck of 10 cards to return it to its original order? (I.e., for what k is A10k=I?) How many for 12 cards? Take a guess at the numbers for a bridge deck of 52 and a Pinochle deck of 48.
*MATLAB or any Software Language may be used. Please show all work and explain thoroughly.
The language used is python. I have explained each step.
import itertools #for concatenating two lists
def perfectShuffle(deck): # the perfect shuffle function will
shuffle the deck of cards 'deck' one time
mid = len(deck) // 2 # finds the mid-way of the 'deck'
first_deck = deck[:mid] # divides the deck into the first
half
second_deck = deck[mid:] # similarly for second half
shuffle_list = list(zip(second_deck,first_deck)) # zip() is a
python function that will pair together two lists, for eg.
zip([4,5,6], [1,2,3]) = [(4, 1), (5, 2), (6, 3)]
shuffle = list(itertools.chain.from_iterable(shuffle_list)) # this
function will convert the above list to a single list
[4,1,5,2,6,3]
return shuffle
def countOfShuffles(start):
count = 1 # the counter will have the number of shuffles
required
end = perfectShuffle(start) # the first shuffle
while (start != end): # checking whether the deck is back to
original state
end = perfectShuffle(end) # if not shuffle again
count += 1
return count # return the count
def main():
A12 = list(range(1,13)) # for n = 6, 2n = 12 and A12 =
[1,2,3,4,5,6,7,8,9,10,11,12]
print (countOfShuffles(A12)) #calling the function
A10 = list(range(1,11))
print (countOfShuffles(A10))
A52 = list(range(1,53))
print (countOfShuffles(A52))
A48 = list(range(1,49))
print (countOfShuffles(A48))
if __name__ == "__main__":
main()
Code
Output
If you take a deck of 2n playing cards, cut it into two stacks of n...
If you take a deck of 2n playing cards, cut it into two stacks of n and interleave them, you have performed a perfect shuffle. Example: for the six-card deck [1 2 3 4 5 6]T , the result is [4 1 5 2 6 3]T (note that the top card of the second stack goes on top. Write down the matrix A2n for a perfect shuffle of 2n cards when 2n=10 and 2n=12. How many times must you (perfectly)...
3. For a deck consisting of 32 playing cards, let A denote the riffle shuffle which interleaves the top half of the deck with the bottom half, but keeps the top and bottom cards fixed Similarly let B denote the other kind of riffle (in which all cards move). (a) Write out the permutations, of the 32 positions in the deck, represented by these riffles A and B. Give each as a product of cycles b) How many different rearrangements...
13. [3] You shuffle a deck of playing cards and the chance you get a diamond card is 0.25. You repeat this process 200 times, putting the card back each time, and out of those 200 attempts you get 57 diamond cards. This demonstrates a. The law of large numbers b. The law of averages 14. [3] You shuffle a deck of playing cards and the chance you get a diamond card is 0.25. You repeat this process times, putting...
5. Consider the following method of tacking playing cards off a table: If you only have one card, place the card so it is halfway over the table. If you have two cards, place the top card so that half of it is hanging over the second card, and the second card such that 1 of it is hanging over the table. If you have three cards, place the top card so that half of it is hanging over the...
Use inheritance and classes to represent a deck of playing cards. Create a Cardclass that stores the suit (e.g. Clubs, Diamonds, Hearts, Spades), and name (e.g. Ace, 2, 10, Jack) along with appropriate accessors, constructors, and mutators. Next, create a Deck class that stores a vector of Card objects. The default constructor should create objects that represent the standard 52 cards and store them in the vector. The Deck class should have functions to: • Print every card in the...
You are dealt two playing cards from a shuffled 52-card deck. Per usual, this deck contains 4 aces. What is the probability that both of your cards are aces?
You are dealt two cards successively without replacement from a standard deck of 52 playing cards. Find the probability that the first card is a two and the second card is a ten. SHOWWORK! Round your answer to three decimal places.
Play Your Cards Right Obtain a standard deck of 52 playing cards. Mix them well and count out 25 cards WITHOUT LOOKING AT THEM. Put aside the remaining cards. You are going to perform an experiment to estimate the probablity of drawing a club, a diamond, a heart, and a spade from your deck of 25 cards. A. Mix the 25 cards well Draw one card. Record its occurrence in the approprlate box. below B. Replace the card and shuffle...
4. Playing poker, you are dealt five cards from a deck of 52 playing cards. (Remember there are 4 suits (spades, hearts, diamonds, clubs) of 13 cards in each suit (A,K,Q,J,10,9,8,7,6,5,4,3,2).) What is the probability of being dealt at least one Ace in those first 5 cards? (without replacement) _________________ 5. Six books are randomly stacked on a desk. What is the probability that they will, by chance, be perfectly stacked in alphabetical order? ______________ 6. A group of 10...
3. You have a standard deck of 52 playing cards. There are two colors (black and red) and four suits (spades are black, clubs are black, hearts are red, and diamonds are red). Each suit has 13 cards, in which there is an ace, numbered cards from 2 to 10, and three face cards (jack, queen, and king) a. You randomly draw and then replace a card. What's the probability it's an ace? What's the probability it's the 4 of...