I'm working on a problem about shuffling decks, using https://mathworld.wolfram.com/Out-Shuffle.html
So I need to find all deck sizes $n$ where you can shuffle (using out-shuffle) so that it returns to the original order in a given number $k$ shuffles.
What I've gathered, after help from the friendly folks here at Math Stack Exchange, is that I need to factorize the following, for my given $k$:
$$ 2^{k} \equiv 1 \mod (n-1) $$
i.e factorize for
$$ 2^{k} - 1 $$
For $k=8$, I know from a brute-force attempt, that the correct list of deck sizes should be:
$$ [18, 52, 86, 256] $$
How do I go from the above formulas to all the divisors, to this list?
While all divisors $\ d\ $ of $\ 2^8-1\ $ will satisfy the congruence $\ 2^8\equiv$$ 1\pmod{d}\ $ , you only want the ones for which $8$ is the order of $2 \pmod{d}\ $—i.e. those which do not divide $\ 2^2-1=3\ $ or $\ 2^4-1=15\ $. So, from the list of non-unit divisors $\ 3,$$5,$$17,$$15,$$51,$$85,$ and $255$, of $\ 2^8-1\ $ you have to eliminate $\ 3,$$5,$ and $15$, leaving $17,$$51,$$85$ and $255$, which gives you your list of $18,$$52,$$86,$ and $256$ as the possible values for $\ n\ $.
More generally, after getting all the divisors $\ d\ $ of $\ 2^k-1\ $, you need to eliminate any which divide $\ 2^r-1\ $ for any factor $\ r<k\ $ of $\ k\ $.