6

Let $[q] = \{0,\dots,q-1\}$, $p < q$.

Consider the function $\mathbf{p}: [q] \rightarrow [q]$ which sends $x \mapsto p·x\operatorname{mod}q$, i.e. the multiplication by $p$ modulo $q$ on $[q]$.

One finds that when $p$ and $q$ are coprime, $\mathbf{p}$ is a permutation of $[q]$ with $\mathbf{p}(0) = 0$.

Each such permutation – depending solely on $p$ and $q$ – has a specific cycle spectrum: $n_m$ cycles of length $m$.

How do I calculate the possible cycle lengths $m$ and their corresponding numbers $n_m$ just by looking at $p$ and $q$?

Bill Dubuque
  • 282,220

2 Answers2

3

Let $H_q = \{ p^n \bmod q,n \ge 0\}$, it contains $|H_q| = $ "the order of $p\bmod q$" elements.

  • Assume $\gcd(a,q)=1$ then $a \in (\mathbb{Z}/q\mathbb{Z})^\times$ so $|aH_q| = |H_q|$

  • Otherwise let $g = \gcd(a,q)$. Then $\frac{a}{g} \in (\mathbb{Z}/q\mathbb{Z})^\times$ and $|a H_q|= |g \frac{a}{g} H_q|=|g H_q| = |g H_{\frac{q}{g}}| = |H_{\frac{q}{g}}|$

  • Thus for each $d = \frac{q}{g} | q$ there are $\frac{\varphi(d)}{|H_{d}|}$ cycles of length $|H_{d}| = $ the order of $p \bmod d$

  • To know the order of each $p \bmod d$, you can factorize $q = \prod_j p_j^{e_j}$ and compute the order of $p \bmod p_j^m,m \le e_j$, then $|H_{\prod_j p_j^{m_j}}|$ is the $lcm$ of the $|H_{p_j^{m_j}}|$

reuns
  • 79,880
  • Would you mind to help me to align your answer with the special case 49:243 as depicted in my question? (It's not too obvious how to start off.) – Hans-Peter Stricker Dec 06 '18 at 17:04
  • https://www.wolframalpha.com/input/?i=Table%5B%7B3%5En,MultiplicativeOrder%5B+49,3%5En%5D%7D,%7Bn,0,5%7D%5D and $\varphi(3^n) = 2.3^{n-1}$ @HansStricker – reuns Dec 06 '18 at 17:08
  • This looks promising, but (i) What does $2.3^{n-1}$ mean? Should it be $2\cdot 3^{n-1}$? and (ii) I'm looking for an expression with a variable which I can set to $243$. (Actually I see only a variable which I can set to $49$. And $243$ comes only in the result.) – Hans-Peter Stricker Dec 06 '18 at 17:24
  • $3^n$ are the divisors of $243$ and $\varphi$ is the Euler totient. Do you understand how multiplication by 49 acts on the group of integers coprime with $243$ ? @HansStricker – reuns Dec 06 '18 at 17:28
  • I know the symbol and meaning of the Euler totient. And now I see: $3^1 = 3$, $3^2=9$, $3^3 = 27$, $3^4 = 81$, $3^5 = 243$ are exactly the divisors of $243$. That's interesting enough, I was not aware of. – Hans-Peter Stricker Dec 06 '18 at 17:31
  • To make it explicit: My question did concern how multiplication by $49$ mod $243$ acts on the set of integers $< 243$ - not on the group of integers coprime with $243$. But maybe it's the same? – Hans-Peter Stricker Dec 06 '18 at 17:34
  • Finally I got it: $\phi(243) = \phi(3^5) = 162 = 2\cdot 81 = 2\cdot 3^4$. That's really crazy. But: It's only a special case. What's the general lesson to learn? – Hans-Peter Stricker Dec 06 '18 at 17:40
  • What about the general case $\phi(p^q)$ - assuming or not that $p,q$ are prime or coprime? Nothing like $\phi(p^q) = (p-1)\cdot p^{q-1}$ will hold, or does it? (If so, it would be the greatest miracle of all times.) – Hans-Peter Stricker Dec 06 '18 at 17:52
  • @HansStricker I treated those coprime to $243$ in the first bullet : multiplication by $49 \bmod 243$ permute those in $\frac{2 . 3^4}{81}$ cycles of length $81$. Why 81 ? Because that's what wolframalpha told for the order of $49 \bmod 243$. The next step is to apply the same reasoning to those of the form $g b$ with $g | 243$ and $b$ coprime to $243/g$ – reuns Dec 06 '18 at 18:16
  • To be sure and explicit: you prefer to write $2.3^n$ instead of $2\cdot 3^n$? It's OK, but I want to be sure. – Hans-Peter Stricker Dec 06 '18 at 19:08
  • Maybe you want to have a look at some visual examples in my answer below. – Hans-Peter Stricker Dec 07 '18 at 11:42
  • Would you be so kind as to prove the bullet points, especially the last two? – Hans Dec 15 '24 at 14:15
2

Having digested and finally understood user reuns' answer, let me share some visual examples:

enter image description here

enter image description here

enter image description here