Hacker News new | ask | show | jobs
by have_faith 2149 days ago
There's a sort of magic trick involving doing perfect riffle shuffles where the whole deck retains it's order. If my memory is correct if you perform 8 perfect riffle shuffles (split deck 50/50, riffle one for one card correctly) then the order resets itself after 8 shuffles. It's usually only performed as a demonstration of skill by experienced card magicians than as a standalone trick.
6 comments

Yup! That's correct, here's a demonstration:

https://www.youtube.com/watch?v=rEoYwyHddLc

Explaining why it works is an exercise in number theory. For example, card 1 stays in place; card 2 goes to position 3, then 5, then 9, then 17, ... In short, the reason why it works is that 2^8 - 1 is divisible by 52 - 1.

What amazing control in that video. From the very start, spreading the cards so evenly that every single card can be shown to be in order, then even more the precision needed to riffle the cards together perfectly eight times.
It you want to see more amazing, Ricky Jay could do this while keeping up a stream of amusing patter and making his hand motions seem almost casual. E.g. https://www.youtube.com/watch?v=eonlrksCsw8
Richard Turner does it with patter, casual motions, and while being blind.

https://en.wikipedia.org/wiki/Richard_Turner_(magician)

He had some interesting appearances on Penn and Teller's show 'Fool Us': https://www.youtube.com/watch?v=TwFIJyWKs1k
How can someone with that level of precision tolerate the wrinkled table cloth!
Yes it's 8 perfect riffles. What the article doesn't seem to stress is that there are two different riffles—an in shuffle (top card moves to second) and an out shuffle (top card stays on top). It's only 8 with an out shuffle I think, but 52 with an in shuffle. So presumably their figure of 7 is referring to the in shuffle (as being 1 shuffle away from the original order doesn't sound too shuffled to me).

The in shuffle is n shuffles in general to get back to the start but the out shuffle isn't such a simple pattern.

If you want to make a shuffle that will take _even longer_ to get back to it's starting point, the best you can do is the Landau function which as you can see can get very big: https://oeis.org/A000793/list (I have a calculation of g(52) but not on me right now)

For more than you ever wanted to know on the mathematics of a perfect shuffle, see this paper:

http://statweb.stanford.edu/~cgates/PERSI/papers/83_05_shuff...

I saw one of the authors, Persi Diaconis, give a talk on this paper, and then perform a perfect shuffle. I was floored.

Your statement about in shuffles for general n is false. Consider that an in shuffle on n cards is identical to an out shuffle on the middle n of n+2 cards.

Also, the statement in the article is for a random riffle, not a perfect one. Any deck which has only been perfectly riffled is entirely determined.

This really makes my head hurt, haha. I've always heard the 7 shuffles to be randomized. Great. But if I shuffle one more time it's back to where I started? How does that makes sense?!

Of course, this is dependent on perfect shuffles, which I'm sure I never achieve. Maybe the 'seven shuffles to randomize' calculation takes into account the 'human' nature of shuffling during a game? It is almost a sure thing the deck will never be split perfectly in half, and a perfect faro shuffle achieved.

Someone else mentioned that it depends on if it's an 'in' or an 'out' riffle as well, so I read the wiki page. The basically tells me you should always try to do an 'in' shuffle, I will have to start looking out for this :)

Two different meanings of perfect are being used. For eight "perfect" riffles to return to the starting order, you've got to split the deck perfectly in half, and then drop one card from one half, then one from the other, and so on alternating. For perfect randomness, choose at random which half to drop a card from each time.
Most smarter magicians think that it is a waste to show off things like this as demonstrations. There is a number of extremely clever card tricks that use the principle mentioned by you as one of their components, but you won't notice. It can be hidden in clever ways.
It's usually done with a so-called "faro shuffle". The mechanics behind it are really interesting and once you get good at it you can almost always guarantee perfect shuffles.