[Jprogramming] Permutations, primes and modular arithmetic
Jimmy Gauvin
jimmy.gauvin at gmail.com
Wed Jan 29 01:19:46 UTC 2020
Hi,
I am looking for some reference texts on permutations and modular
arithmetic.
I recently stumbled on some interesting properties of card shuffles.
For example, using a deck of 11 cards labeled 0 through 10 and shuffling
them to obtain this layout :
0 6 1 7 2 8 3 9 4 10
There are several ways to find out which position each card occupies .
1) index of
0 6 1 7 2 8 3 9 4 10 i. i.11
0 2 4 6 8 10 1 3 5 7 9
2) grading
/: 0 6 1 7 2 8 3 9 4 10
0 2 4 6 8 10 1 3 5 7 9
3) and computing the positions with modulo
11 | 2*i.11
0 2 4 6 8 10 1 3 5 7 9
Going from the positions to the card layout can also be done several ways :
4) assignment
(i.11) ( 0 2 4 6 8 10 1 3 5 7 9 ) } 11$0
0 6 1 7 2 8 3 9 4 10
5) grading
/: 0 2 4 6 8 10 1 3 5 7 9
0 6 1 7 2 8 3 9 4 10
6) and, this is the kicker for me, modulo with the right multiplier
11 | 6*i.11
0 6 1 7 2 8 3 9 4 10
While 3) is obvious, I find 6) disconcerting. And it seems to work for all
cases where the number of cards and the interval between cards are coprime.
I know this must be explained somewhere but I can't find the relevant
material.
Thanks for your assistance,
Jimmy
More information about the Programming
mailing list