0

Consider a deck of $52$ cards. They are shuffled into two stacks, the first $26$ and the last $26$. Then, we alternate by putting one card from the last $26$ and one card from the first $26$. For instance, the order in the new deck is $27, 1, 28, 2, \dots$, assuming that we originally labelled the cards starting from $1$. This process continues until the original order is obtained again. How many shuffles will this require?

Let us associate the cards with labels $1, 2, 3, \dots$. Clearly, we have that card in position $k$ will move to position $$ (2k) \bmod 53. $$ Then we need only find the minimal integer $\ell$ such that $2^\ell \bmod 53 = 1$. I seem to have found that the solution is $\ell = 52$.

Is there a more clever way to find the solution to that equation other than just iterating through all possible values of $\ell$?

Gary
  • 36,640
Drew Brady
  • 4,133
  • Well, the order has to be a divisor of $\varphi(53)=52$ so you could just try those. Easy to rule out $2$ being a square so that helps, but the answer is $52$ so it's not going to be simple mental arithmetic. – lulu Aug 17 '24 at 00:41
  • Since $53$ is prime, we know that $2^{52} \equiv 1 \pmod{53}$, so all that's necessary is to check $2^2, 2^4$, and $2^{13}$. The first two are obvious by inspection. – Robert Shore Aug 17 '24 at 00:41
  • 2
    @RobertShore Can you rule out $2^{26}$ so quickly? I guess once you note that $2^{13}\not \equiv -1 \pmod {53}$ you can rule it out. – lulu Aug 17 '24 at 00:42
  • 1
    @RobertShore What we need to check is $2^{n/p}$ for any prime dividing $n$. IE $ 2^{52/2} , 2^{52/13}$ are not $\equiv 1$. If they are, then we repeat the $n'/p$ process. Checking from the ground up isn't as helpful (but does allow us to eliminate small values, which are easier to check) – Calvin Lin Aug 17 '24 at 00:55
  • COMMENT.-A good way is to take into account that $2$ is a primitive root modulo $53$. Also $3,5,12$ are another ones, so we have $a^{52}\equiv1\pmod{53}$ for $a=3,5,12$ and for all primitive rootmodulo $53$. – Ataulfo Aug 17 '24 at 00:57
  • 2
    @Piquito: but how do you know that $2$ is a primitive root? That's the point of the question, isn't it? – TonyK Aug 17 '24 at 00:59
  • The method in @Rob's comment is a special case of the Order Test linked in the dupe. – Bill Dubuque Aug 17 '24 at 01:18
  • @Bill I guess you wanted to mention Calvin's comment rather than Robert's? – Jyrki Lahtonen Aug 17 '24 at 01:57
  • The extensions of quadratic reciprocity imply that $2$ is not a quadratic residue modulo $53$. Therefore $2^{26}\equiv-1$, and primitivity follows. – Jyrki Lahtonen Aug 17 '24 at 02:00
  • Anyway, the thinking here is a most useful shortcut when proving imprimitivity. The order test, while useful, typically leaves uncomfortably large cases to be checked. When the modulus is a prime number $p$ of the form $p=2^aq+1$, where $q$ is another prime (here $p=53$ and $q=13$, the efficient way to rule out $(p-1)/2$ as the order by using quadratic reciprocity is the key idea. Ruling out $2^a$ is usually simpler. – Jyrki Lahtonen Aug 17 '24 at 02:28
  • 1
    @Jyrki Oops, yes I meant Calvin's comment. The order test works more generally. Which method ends up being most efficient is generally case dependent. Note that QR may not be known by the OP. – Bill Dubuque Aug 17 '24 at 03:25
  • @Jryki Of course there are even older posts mentioning using QR / Legendre symbols / Euler's criterion, e.g. this 2011 post (and this is linked in my oft-linked post on mod order reducton, so anyone using that to compute modular powers would already get said QR optimization). $\ \ $ – Bill Dubuque Aug 17 '24 at 04:12
  • @Tony K: Do you not know that $p$ has $\phi(p-1)$ primitive roots?. You are right in the question of verification but I gave this as datta. Just when I am going to change to the comments I saw that it won a donwvote. Regards. – Ataulfo Aug 17 '24 at 16:44
  • @Piquito: How is it relevant that $53$ has $\phi(52)$ primitive roots? And not that it matters, but it wasn't me who downvoted. – TonyK Aug 17 '24 at 17:15

0 Answers0