Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
I think perfect shuffles as permutations are n-cycles. I have no idea how they decompose and I'm probably not going to research it, but this means that at worst the n-th power is identity.
-
Hazarth95023yIt's 8 but the formal proof eludes me
I think its enough to reset the second number. And the second number travels in an exponential way through the shuffled list. So the position offsrt of the second digit can be predicted as (2^n)-1 and for the number to do a perfect loop it has to have an offset that's divisible by the length of the array - 1.
So if you solve:
Arr = (52 cards)
(2^n)-1 mod (len(arr)-1) == 0
For the lowest N, you get
(2^n)-1 mod 51 == 0
And this is first true for N=8
255 mod 51 == 0
I tested this on several array lengths and it works for any array length I tested, but Im unable to figure out a formal proof to justify this... But yeah, its 8
Related Rants
Given an ordered deck of cards (like those for poker), if you split evenly in 26 cards and riffle shuffle perfectly one card over another, how many riffle shuffles should you perform to have the deck ordered as in the beginning?
random
cards