mollwollfumble said:
The Rev Dodgson said:
It seems that deck stacking is a gigantic hole in my education.
If it can be done so reliably and easily by those practiced at it, how come anyone bothers playing card games any more?
Ditto. Also a gigantic hole in my education.
Apart from Bridge tournaments, I don’t know anyone who does play card games with real cards any more. It may be significantly more difficult to stack the deck for Bridge than for Poker. Bridge needs all 52 cards.
Let me start from a position of near-complete ignorance. So please correct what I suggest.
Start with just 10 cards for simplicity, call the initial order 0123456789 with 0 at the top. Total number of permutations is 10! = 3628800
There are three acceptable types of shuffle:
a) The cut eg. 5678901234
b) The pain shuffle eg. 9876543210
c) The riffle shuffle eg. 0246813579
a) The cut. Easiest to control, hardest to cheat on. A cheat on the cut would keep the bottom cards at the bottom, such as 5678012349.
b) The plain shuffle is a set of cuts. But how many cuts? Perhaps aim for in the rough order of ceiling(sqrt(n)) cuts. 3 cuts for 6 cards, 4 cuts for 10 cards, 8 cuts for 52 cards? But what is the acceptable range for the number of cuts? So a typical plain shuffle might be 9784562301. One cheat would be to keep the bottom cards on the bottom such as 8745623019. Then there’s shuffling to the bottom of the deck such as 9876432105. A plain cut always moves a the middle of the deck towards the outside, usually front, and the front of the deck towards the back. Two iterations of 9876543210 take you straight back where you started, 0123456789. For every acceptable plain shuffle, there is a second acceptable(?) plain shuffle that is the exact inverse.
c) I know SFA about riffle shuffles. A perfect riffle shuffle yields either 0246813579 or 1357902468. An imperfect, ie. normal, riffle shuffle is, well, a large number of cuts. How many? A riffle shuffle may be the easiest way to leave the front cards of the deck on the front, (the other way being a pair of plain shuffles).
So stacking could be done on the front of the deck – riffle shuffle, back of the deck – plain shuffle, or both. If both then a single plain shuffle could bring front and back stacks together, such as 012…89 gives either …01289 or …21089 or … 20189 or … 12089 but not (with any ease) the other permutations.
There are a couple of science papers on permutations and cuts.
https://arxiv.org/pdf/1502.07971.pdf
“A simple framework on sorting permutations
Ricky X. F. Chen·Christian M. Reidys
In this paper we present a simple framework to study various distance problems of permutations, including the transposition and block-interchange distance of permutations as well as the reversal distance of signed permutations. These problems are very important in the study of the evolution of genomes.”
LOL, so the mathematics of stacking cards is the same as the mathematics of chromosomal disorders in genomes. I never thought that this was going to end up being a thread about genomes. Note that the “genetic algorithm” works in a bit the same way.
> one-line form: π is represented as a sequence π=π(1)π(2)···π(n−1)π(n).
> cycle form: regarding〈π〉as a cyclic group, we represent π by its collection of orbits (cycles).
That’s part of what i’m looking for. Other paper.
“Information Processing Letters 60 (1996) 165-169
Sorting permutations by block interchanges
David A. Christie”
> In this paper we introduce an operation, called block-interchange, in which two substrings, or blocks, swap positions in the permutation.
That’s four cuts, isn’t it. Any four cuts?

> Lemma 1. It is always possible to find a block-interchange that removes at least two breakpoints (sometimes 3 or 4) from a given permutation, Π unless Π is the identity.
Hmm, this may end up as something bleedin’ obvious, such as saying that every permutation of 52 cards can be generated by 51 cuts.
Almost equally obvious, at most one perfect plain shuffle and 25 cuts will suffice. Because a plain shuffle takes the number of breakpoints from 51. So if the original permutation has 26 breakpoints then a plain shuffle reduces that to 51 – 26 = 25 and each cut removes one of those.
The “block-interchange diameter” BID is the minimum number of block interchanges required to find every permutation. For 52 cards it is 52/2 = 26. So essentially what the article is saying is that 26 cut pairs will suffice to completely stack a set of 52 cards.
Yeah, the result is bleeding’ obvious. The paper does give “The number of permutations of size n that achieve BID” for up to 10 cards in a pack, which is interesting. For 10 cards using block-interchange the number of permutations that require 5 cut-pairs is 604,800. That there is more than 1 is shown by the fact that … I’ll leave that as an exercise for the reader.
10! / 604,800 = 6.
8! / 8,046 = 5.01.
So perhaps with 52 cards the probability that a random deck will have the worst possible BID is near 1/(52/2+1) = 3.7%.
Slightly disappointed. But at least it does mean that stacking cards is a cutting edge problem in applied mathematics.
“evolution of genomes” – I can’t help chuckling.