All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Just Math
Weird shuffling (Posted on 2020-11-29) Difficulty: 2 of 5
John has a deck of 52 cards, stacked in a pile with their backs facing up. He separates the small pile consisting of the seven cards on the top of the deck, turns it upside down, and places it at the bottom of the deck. All cards are again in one pile, but not all of them face down; the seven cards at the bottom do, in fact, face up. He repeats this move until all cards have their backs facing up again. In total, how many moves did John make?

No Solution Yet Submitted by Danish Ahmed Khan    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution re(2): computer verification -- simulation | Comment 4 of 8 |
(In reply to re: computer verification -- bug -- changed result by Charlie)

deck0=zeros(1,52);
deck=deck0;
ct=0;
while ~isequal(deck,deck0) | (ct==0)
   deck=[deck(8:52),1-fliplr(deck(1:7))];
   ct=ct+1;
   s=num2str(deck);
   fprintf('%3d %s\n',ct,erase(s,' '))
end
ct
produces

  1 0000000000000000000000000000000000000000000001111111
  2 0000000000000000000000000000000000000011111111111111
  3 0000000000000000000000000000000111111111111111111111
  4 0000000000000000000000001111111111111111111111111111
  5 0000000000000000011111111111111111111111111111111111
  6 0000000000111111111111111111111111111111111111111111
  7 0001111111111111111111111111111111111111111111111111
  8 1111111111111111111111111111111111111111111110000111
  9 1111111111111111111111111111111111111100001110000000
 10 1111111111111111111111111111111000011100000000000000
 11 1111111111111111111111110000111000000000000000000000
 12 1111111111111111100001110000000000000000000000000000
 13 1111111111000011100000000000000000000000000000000000
 14 1110000111000000000000000000000000000000000000000000
 15 1110000000000000000000000000000000000000000001111000
 16 0000000000000000000000000000000000000011110001111000
 17 0000000000000000000000000000000111100011110001111111
 18 0000000000000000000000001111000111100011111111111111
 19 0000000000000000011110001111000111111111111111111111
 20 0000000000111100011110001111111111111111111111111111
 21 0001111000111100011111111111111111111111111111111111
 22 0001111000111111111111111111111111111111111110000111
 23 0001111111111111111111111111111111111100001110000111
 24 1111111111111111111111111111111000011100001110000111
 25 1111111111111111111111110000111000011100001110000000
 26 1111111111111111100001110000111000011100000000000000
 27 1111111111000011100001110000111000000000000000000000
 28 1110000111000011100001110000000000000000000000000000
 29 1110000111000011100000000000000000000000000001111000
 30 1110000111000000000000000000000000000011110001111000
 31 1110000000000000000000000000000111100011110001111000
 32 0000000000000000000000001111000111100011110001111000
 33 0000000000000000011110001111000111100011110001111111
 34 0000000000111100011110001111000111100011111111111111
 35 0001111000111100011110001111000111111111111111111111
 36 0001111000111100011110001111111111111111111110000111
 37 0001111000111100011111111111111111111100001110000111
 38 0001111000111111111111111111111000011100001110000111
 39 0001111111111111111111110000111000011100001110000111
 40 1111111111111111100001110000111000011100001110000111
 41 1111111111000011100001110000111000011100001110000000
 42 1110000111000011100001110000111000011100000000000000
 43 1110000111000011100001110000111000000000000001111000
 44 1110000111000011100001110000000000000011110001111000
 45 1110000111000011100000000000000111100011110001111000
 46 1110000111000000000000001111000111100011110001111000
 47 1110000000000000011110001111000111100011110001111000
 48 0000000000111100011110001111000111100011110001111000
 49 0001111000111100011110001111000111100011110001111111
 50 0001111000111100011110001111000111100011111110000111
 51 0001111000111100011110001111000111111100001110000111
 52 0001111000111100011110001111111000011100001110000111
 53 0001111000111100011111110000111000011100001110000111
 54 0001111000111111100001110000111000011100001110000111
 55 0001111111000011100001110000111000011100001110000111
 56 1110000111000011100001110000111000011100001110000111
 57 1110000111000011100001110000111000011100001111111000
 58 1110000111000011100001110000111000011111110001111000
 59 1110000111000011100001110000111111100011110001111000
 60 1110000111000011100001111111000111100011110001111000
 61 1110000111000011111110001111000111100011110001111000
 62 1110000111111100011110001111000111100011110001111000
 63 1111111000111100011110001111000111100011110001111000
 64 0001111000111100011110001111000111100011110000000000
 65 0001111000111100011110001111000111100000000000000111
 66 0001111000111100011110001111000000000000001110000111
 67 0001111000111100011110000000000000011100001110000111
 68 0001111000111100000000000000111000011100001110000111
 69 0001111000000000000001110000111000011100001110000111
 70 0000000000000011100001110000111000011100001110000111
 71 0000000111000011100001110000111000011100001111111111
 72 1110000111000011100001110000111000011111111111111111
 73 1110000111000011100001110000111111111111111111111000
 74 1110000111000011100001111111111111111111110001111000
 75 1110000111000011111111111111111111100011110001111000
 76 1110000111111111111111111111000111100011110001111000
 77 1111111111111111111110001111000111100011110001111000
 78 1111111111111100011110001111000111100011110000000000
 79 1111111000111100011110001111000111100000000000000000
 80 0001111000111100011110001111000000000000000000000000
 81 0001111000111100011110000000000000000000000000000111
 82 0001111000111100000000000000000000000000001110000111
 83 0001111000000000000000000000000000011100001110000111
 84 0000000000000000000000000000111000011100001110000111
 85 0000000000000000000001110000111000011100001111111111
 86 0000000000000011100001110000111000011111111111111111
 87 0000000111000011100001110000111111111111111111111111
 88 1110000111000011100001111111111111111111111111111111
 89 1110000111000011111111111111111111111111111111111000
 90 1110000111111111111111111111111111111111110001111000
 91 1111111111111111111111111111111111100011110001111000
 92 1111111111111111111111111111000111100011110000000000
 93 1111111111111111111110001111000111100000000000000000
 94 1111111111111100011110001111000000000000000000000000
 95 1111111000111100011110000000000000000000000000000000
 96 0001111000111100000000000000000000000000000000000000
 97 0001111000000000000000000000000000000000000000000111
 98 0000000000000000000000000000000000000000001110000111
 99 0000000000000000000000000000000000011100001111111111
100 0000000000000000000000000000111000011111111111111111
101 0000000000000000000001110000111111111111111111111111
102 0000000000000011100001111111111111111111111111111111
103 0000000111000011111111111111111111111111111111111111
104 1110000111111111111111111111111111111111111111111111
105 1111111111111111111111111111111111111111111111111000
106 1111111111111111111111111111111111111111110000000000
107 1111111111111111111111111111111111100000000000000000
108 1111111111111111111111111111000000000000000000000000
109 1111111111111111111110000000000000000000000000000000
110 1111111111111100000000000000000000000000000000000000
111 1111111000000000000000000000000000000000000000000000
112 0000000000000000000000000000000000000000000000000000

ct =

   112


  Posted by Charlie on 2020-11-29 20:50:02
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (0)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information