Skip to main content
5 of 12
deleted 31 characters in body
GH from MO
  • 105.2k
  • 8
  • 292
  • 398

The answer is yes when $q=p+1$. It suffices to shows that for any positive integer $M$ there exists a prime $N\nmid M$ with the required two properties.

Let $k>M$ be a prime such that $k\equiv 1\pmod{\varphi(M)}$, this exists by (the easiest case of) Dirichlet's theorem on primes. Then $p^k-q\equiv p-q=-1\pmod{kM}$, hence $p^k-q\not\equiv 1\pmod{k}$ and $(p^k-q,M)=1$. It follows that $p^k-q$ has a prime divisor $N\not\equiv 1\pmod{k}$ not dividing $M$. Note also that $(N,pq)=1$ by $(p,q)=1$. As $(k,N-1)=1$, there exist a positive integer $l$ such that $kl\equiv 1\pmod{N-1}$. Hence $q^l\equiv p^{kl}\equiv p\pmod{N}$, and we are done.

GH from MO
  • 105.2k
  • 8
  • 292
  • 398