We know that the order of an element $a$ in the group $\mathbb Z_n^*$ is $k$ where $k|lcm(p-1,q-1)$ where p,q are distinct primes.

Something else i think we know is that the elements that have order $lcm(p-1,q-1)$ will generate exactly $\frac{φ(n)}{lcm(p-1,q-1)}$ different subgroups which may have common elements (in order to jointly generate all the elements of the group). Based on that, if the n was prime, we could easily count the elements of each order by doing $φ(order)$. (if it is prime, one element could generate all the others)

Is it possible to count how many elements have a given order?

For example: $n=5*7$

How many elements have order 6? (I know it's 6, but is there a generic way to find it?)

CRT could give an approximation in this case but you should still filter out the elements that may have smaller order that divides in this case 6 (1,2,3).

Here are the subgroups with order 12:


One interesting detail is that the generators for each group are present to exactly three other subgroups. For example, 33 is inside 3,12,17 subgroups. (each contains the other elements in positions m where $gcd(m, 12)=1$ so we have 4 permutations of each of the two subgroups)

With order 6:


Here, each generator is present in another subgroup


My second theorem seems to be little flawed: I assumed that combining all the subgroups of order $lcm(p-1,q-1)$ would generate all the elements of the multiplicative group n. But as we can see from my example, they do not since they don't generate the elements 6,19,24,26,31,34.

Here are some good resources that could be useful mult. groups mod n and carmichael function.


closed as off-topic by fkraiem, e-sushi May 14 '17 at 23:32

  • This question does not appear to be about cryptography within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ Indeed, i have fixed that. For your previous point, wouldn't saying multiplicative group imply the $\mathbb Z_n^*$ $\endgroup$ – Antonis Paragas May 14 '17 at 14:48
  • $\begingroup$ $\mathbb Z_n^*$ is the multiplicative group modulo $n$, and yes that from does the job without writing $\mathbb Z_n^*$. I've never seen multiplicative group $n$ or multiplicative group $n=pq$ in a reference text or paper. $\endgroup$ – fgrieu May 14 '17 at 16:58
  • 1
    $\begingroup$ I'm voting to close this question as off-topic because it is about general mathematics. $\endgroup$ – fkraiem May 14 '17 at 17:02
  • $\begingroup$ But recall the CRT, in particular the part which asserts a ring isomorphism... en.wikipedia.org/wiki/… $\endgroup$ – fkraiem May 14 '17 at 17:04
  • $\begingroup$ I posted it here since i started thinking about it after I came across link But maybe I should post it in the maths. $\endgroup$ – Antonis Paragas May 14 '17 at 17:29

It's not hard to compute, the number of elements with order precisely $r$ is:

$$F_{p-1, q-1}(r) \phi(r)$$

where $F$ is this function:

If the prime factorization of $r = r_1^{e_1} r_2^{e_2} ... r_n^{e_n}$ then

$$F_{p-1, q-1}(r) = F_{p-1, q-1}(r_1^{e_1}) \cdot F_{p-1, q-1}(r_2^{e_2}) \cdot ... \cdot F_{p-1, q-1}(r_n^{e_n})$$

If $s$ is prime and $e>0$, then $F_{p-1, q-1}(s^e)$ depends on $\gcd( s^e, p-1) = s^a$ and $\gcd( s^e, q-1) = s^b$

If $a, b < e$, then $F_{p-1, q-1}(s^e) = 0$ (i.e. there are no elements with that order)

If $a=e, b < e$, then $F_{p-1, q-1}(s^e) = s^b$

If $b=e, a< e$, then $F_{p-1, q-1}(s^e) = s^a$

If $a=b=e$, then $F_{p-1, q-1}(s^e) = s^e + s^{e-1}$

This allows us to compute the number of elements in all cases.

  • 1
    $\begingroup$ No proof, not even an explanation of where everything is coming from... sorry, I have to downvote. $\endgroup$ – fkraiem May 14 '17 at 20:57
  • $\begingroup$ @fkraiem: proof is fairly straight-forward, if a bit tedious; basically, you note that the group $\mathbb{Z}_{pq}^*$ is isomorphic to the group $\mathbb{Z}/(p-1) \times \mathbb{Z}/(q-1)$ (where those are the additive groups), and then start looking at the subgroups that are of the order of the prime factors of $r$ (and how many of them are there). $\endgroup$ – poncho May 14 '17 at 21:29
  • $\begingroup$ You could probably also use Sylow's theorems for this - that's (one of) the standard group theory tool(s) for counting subgroups of a finite group $\endgroup$ – pg1989 May 15 '17 at 2:13

Not the answer you're looking for? Browse other questions tagged or ask your own question.