• 0

2000 shuffles

Question

Posted · Report post

A shuffle of 2n cards puts the first n cards in the odd positions and the last n cards in the even positions.[For example shuffle (1,2,3,4,5,6) and you get (1,4,2,5,3,6).] Heather has 10 cards, 1-10, Briana has 12 cards, 1-12. Each shuffles her deck 2000 times. "Hey, my deck is back to its original state!"
Who said that, and which card does the other deck have in position #5?
0

Share this post


Link to post
Share on other sites

3 answers to this question

  • 0

Posted · Report post

Briana said it.

There is a 2 in the fifth place of Heather's deck.

s out-shuffles will restore deck a deck of n=2m cards,

where s=ordn-1(2).

For a 10-card deck, that's 6.

Since 2000(mod 6) = 2, 2000 out-shuffles of Heather's deck is equivalent to 2 out-shuffles.

For a 12-card deck, that's 10.

Since 2000(mod 10) = 0, 2000 out-shuffles restores Briana's deck.

0

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

public class Class1 {
    public static void main(String[] args) {
        int[] arr1 = {1,2,3,4,5,6,7,8,9,10};
        int[] arr2 = {1,2,3,4,5,6,7,8,9,10,11,12};
        for(int i=0;i<2000;i++){
            doShuffle(arr1);
            doShuffle(arr2);
        }
        System.out.println("arr1 = "+java.util.Arrays.toString(arr1));
        System.out.println("arr2 = "+java.util.Arrays.toString(arr2));
    }
    private static void doShuffle(int[] arr){
        int[] temp = java.util.Arrays.copyOf(arr, arr.length);
        for(int i=0;i<arr.length;i++){
            arr[i] = temp[i/2 + (i%2)*(arr.length/2)];
        }
    }
}
Result:

arr1 = [1, 8, 6, 4, 2, 9, 7, 5, 3, 10]

arr2 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]

0

Share this post


Link to post
Share on other sites
  • 0

Posted (edited) · Report post

The one who has her cards in order is Briana.


The fifth card in the other deck is 2

By shuffling Heather's cards six times, it goes back to the original state.

So by the 2000th shuffle, it will have the same order as what the deck had after the second shuffle.

Edit: I just realized how tiresome my solution is.

Edited by DeathStone0000
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.