For a given primorial $q\#$, you can generate a subset of the reduced residue system by using the power of a prime $p$ where $p > q$.
For example, for $5\#$, we can use the powers of $7$ to generate $4$ of the elements of the reduced residue system:
- $7^1 \equiv 7 \pmod {30}$
- $7^2 \equiv 19 \pmod {30}$
- $7^3 \equiv 13 \pmod {30}$
- $7^4 \equiv 1 \pmod {30}$
The count of these elements is the solution for $x$ where:
$$p^x \equiv 1 \pmod {q\#}$$
As I understand it, $p^x$ forms a subgroup so it follows that if $q$ is the $n$th prime $p_n$, then by Lagrange's Theorem:
$$x\, | \prod_{i=1}^{n}{p_i - 1}$$
Since $q\# - p^i$ is also an element of the reduced residue system that is distinct from $p^i$, my assumption is that:
$$x\, | \prod_{i=2}^{n}{p_i-1}$$
So, my assumption is that if $x$ is the least postive integer where $p^x \equiv 1 \pmod {q\#}$, then:
$$\prod_{i=2}^{n}{p_i-1}\ge{x}>\log_{p}q\#$$
Other than brute force, is there a standard way to solve for $x$? Is there any other properties that are known about $x$? Are all of my assumptions about $x$ correct?