1
$\begingroup$

Determine the number of pairs of prime numbers $p$ and $q$, both of which are less than $2017,$ such that $p$ divides $q-1$ and $q$ divides $p^3-1$.

If $p = 2$, then $q = 7$ and if $q = 2$, there are no solutions. Now suppose that $p,q > 2$. We have from the given that $q \equiv 1 \pmod{p}$ and $p^3 \equiv 1 \pmod{q}$. Thus, $q = 1+pk$ where $k$ is even and $p^3 = 1+qm$, where $m$ is even. Therefore, $p^3 = 1+m(1+pk)$ and so $m = \dfrac{p^3-1}{pk+1}$.

I didn't see how to continue from here.

2 Answers 2

3

If $p\mid q-1$ then certainly $p

As you wrote, $p=2$ leads to $q$ odd (wow!) and $q\mid p^-1=7$, so $q=7$. Next, $p=3$ leads to $q\mid 9+3+1=13$, so $q=13$, which gives a solution. Then, $p=5$ leads to $q\mid 25+5+1=31$, so $q=31$, which gives a solution.

On the other hand, $p=7$ leads to $q\mid 49+7+1=3\cdot 19$, but $q=19$ does not work, so our luck has come to a halt for the moment.

For a systematic approach: Write $q=kp+1$ with $k\ge2$ (because we already treated the case $p=2$, $q=3$ above), and $p^2+p+1=mq=mkp+m$ with $m\ge1$. Then $p\mid p^2+p-mkp=m-1$, so $m=rp+1$ with $r\ge 0$.

If $r=0$, we are led to $m=1$, $p^2+p+1=q=kp+1$, $k=p+1$. As we want $q<2017$, we must have $p<\sqrt{2017}< 45$. By inspection, we find all primes in this range and check if $p^2+p+1$ is prime: $p=2,3,5,17,41$ (and accordingly $q=7,13,31,307,1723$)

If $r>0$, then $p^2+p+1=(rp+1)(kp+1)\ge krp^2\ge 2p^2>p^2+p+1$, and there is no solution.

1

The answer is 5. There are 840 pairs where q-1 is divisible by p, and 1257 pairs where p^3-1 is divisible by q. The solutions are:

{2, 7}
{3, 13}
{5, 31}
{17, 307}
{41, 1723}

I wrote software to solve this brute force, so I have no equations to show.