Prove that there exist infinitely many prime numbers $p$ such that $\mathrm{ord}_p(a)=\mathrm{ord}_p(b)$. Let $a$, $b$ be distinct positive integers greater than $1$. Prove that there exist infinitely many prime numbers $p$ such that $\mathrm{ord}_p(a)=\mathrm{ord}_p(b)$.


(Here $\mathrm{ord}_p(a)$ is the smallest integer $k&gt;0$ such that $a^k\equiv1\pmod p$.)

This problem is from the 2018 Iranian Math Olympiad. I cannot find any sources for the official answer. I have tried to solve it, but it didn't work. The only thing that I found out is that if $p|\mathrm{gcd}(a-1,b-1)$, then $\mathrm{ord}_p(a)=\mathrm{ord}_p(b)=1$.

Sorry for the lack of information. That is all I have to say.

How can I solve the orange problem? If any sources were known, please post the answers in the answer section here. Any answers, solutions or comments will be appreciated.

If this question cannot be answered, I will delete this post immediately.
Let $a &gt; b\ge 2$ and $p_1,\ldots,p_j$ be a list of primes containing the primes dividing $a$. Let $c &gt; a+b$ and $N = \prod_{i=1}^j (p_i-1) p_i^c$. For a prime power $q^r \equiv 1 \bmod N$, if $p_i \nmid b$ then $b^{q^r}-a \equiv b-a {\scriptstyle\ \not \equiv \ 0}\bmod p_i^c$, if $p_i | b$ then $b^{q^r}-a \equiv -a {\scriptstyle\ \not \equiv \ 0}\bmod p_i^c$.  

Let $h   =\prod p_i^{v_{p_i}(\textstyle b^{q^r}-a)}= (\prod_{p_i | b} p_i^{v_{p_i}(a)}) (\prod_{p_i \nmid b} p_i^{v_{p_i}(b-a)} )$ $\scriptstyle(\text{note it doesn't depend on } q)$ and

$$\frac{b^{q^r}-a}{h} = \prod Q_l^{e_l} \qquad \qquad \scriptstyle (\text{which is coprime with  } p_1\ldots p_j)$$

$b^{q^r}-a \equiv 0 \bmod Q_l, a \not \equiv 0 \bmod Q_l$ implies $\text{order}(a \bmod Q_l) \ |\ \text{order}(b \bmod Q_l)$. 

If also $\gcd(q,Q_l-1) = 1$ then $\text{order}(a \bmod Q_l)= \text{order}(b \bmod Q_l)$.

Assume $\forall l, \gcd(q,Q_l-1) \ne 1$, then $q | Q_l-1, Q_l = m_l q+1$ and $$\frac{b^{q^r}-a}{h} = \prod (m_lq+1)^{e_l} \equiv 1 \bmod q$$
Thus it suffices to choose $q \nmid b-a-h$, $q \nmid N, r = \phi(N)$ to obtain $\frac{b^{q^r}-a}{h}  \not \equiv 1 \bmod q$ so that for some $Q_l | \frac{b^{q^r}-a}{h} $ we'll have $  \gcd(q,Q_l-1) = 1$ and $\text{order}(a \bmod Q_l)= \text{order}(b \bmod Q_l)$.

Add $Q_l$ to the $p_i$ and repeat to generate infinitely many primes such that $\text{order}(a\bmod P)=\text{order}(b\bmod P)$.
Let $a = p_{1}^{\alpha_{1}} p_{2}^{\alpha_{2}} \cdots p_{n}^{\alpha_{n}}$ and $b = q_{1}^{\beta_{1}} q_{2}^{\beta_{2}} \cdots q_{m}^{\beta_{m}}$ be the prime factorization of $a$ and $b$. Define $C$ the set of prime number such that $ord_{p}(a) = ord_{p}(b) = 1$.

Let $S = \{\ p_{1}, p_{2}, \ldots, p_{n}, q_{1}, q_{2}, \ldots, q_{m}\ \}$ and $\mathbb{P}$ the set of prime numbers. Note that if $p$ is a prime number such that $p \in (\mathbb{P} - S)$ then by Fermat's little theorem $a^{p-1} \equiv 1 \pmod{p}$ and $b^{p -1} \equiv 1 \pmod{p}$, hence it is not difficult to show that $ord_{p}(a) = ord_{p}(b) = 1$, i. e., $p \in C$. Therefore $(\mathbb{P} - S)  \subset C$.

Finally, note that if $C$ is finite then $(\mathbb{P} - S)$ is finite and so $\mathbb{P} = S \cup (\mathbb{P} - S)$ is finite which contradicts Euclid's theorem.