Subfield: Number Theory


Question: Find all triples $(p, x, y)$ consisting of a prime number $p$ and two positive integers $x$ and $y$ such that $x^{p-1}+y$ and $x+y^{p-1}$ are both powers of $p$.

Solution:
For $p=2$, clearly all pairs of two positive integers $x$ and $y$ whose sum is a power of 2 satisfy the condition. Thus we assume in the following that $p>2$, and we let $a$ and $b$ be positive integers such that $x^{p-1}+y=p^{a}$ and $x+y^{p-1}=p^{b}$. Assume further, without loss of generality, that $x \leqslant y$, so that $p^{a}=x^{p-1}+y \leqslant x+y^{p-1}=p^{b}$, which means that $a \leqslant b$ (and thus $\left.p^{a} \mid p^{b}\right)$.

Now we have

$$
p^{b}=y^{p-1}+x=\left(p^{a}-x^{p-1}\right)^{p-1}+x .
$$

We take this equation modulo $p^{a}$ and take into account that $p-1$ is even, which gives us

$$
0 \equiv x^{(p-1)^{2}}+x \quad\left(\bmod p^{a}\right)
$$

If $p \mid x$, then $p^{a} \mid x$, since $x^{(p-1)^{2}-1}+1$ is not divisible by $p$ in this case. However, this is impossible, since $x \leqslant x^{p-1}<p^{a}$. Thus we know that $p \nmid x$, which means that

$$
p^{a} \mid x^{(p-1)^{2}-1}+1=x^{p(p-2)}+1
$$

By Fermat's little theorem, $x^{(p-1)^{2}} \equiv 1(\bmod p)$, thus $p$ divides $x+1$. Let $p^{r}$ be the highest power of $p$ that divides $x+1$. By the binomial theorem, we have

$$
x^{p(p-2)}=\sum_{k=0}^{p(p-2)}\left(\begin{array}{c}
p(p-2) \\
k
\end{array}\right)(-1)^{p(p-2)-k}(x+1)^{k}
$$

Except for the terms corresponding to $k=0, k=1$ and $k=2$, all terms in the sum are clearly divisible by $p^{3 r}$ and thus by $p^{r+2}$. The remaining terms are

$$
-\frac{p(p-2)\left(p^{2}-2 p-1\right)}{2}(x+1)^{2}
$$

which is divisible by $p^{2 r+1}$ and thus also by $p^{r+2}$,

$$
p(p-2)(x+1)
$$

which is divisible by $p^{r+1}$, but not $p^{r+2}$ by our choice of $r$, and the final term -1 corresponding to $k=0$. It follows that the highest power of $p$ that divides $x^{p(p-2)}+1$ is $p^{r+1}$.

On the other hand, we already know that $p^{a}$ divides $x^{p(p-2)}+1$, which means that $a \leqslant r+1$. Moreover,

$$
p^{r} \leqslant x+1 \leqslant x^{p-1}+y=p^{a}
$$

Hence we either have $a=r$ or $a=r+1$.

If $a=r$, then $x=y=1$ needs to hold in the inequality above, which is impossible for $p>2$. Thus $a=r+1$. Now since $p^{r} \leqslant x+1$, we get

$$
x=\frac{x^{2}+x}{x+1} \leqslant \frac{x^{p-1}+y}{x+1}=\frac{p^{a}}{x+1} \leqslant \frac{p^{a}}{p^{r}}=p
$$

so we must have $x=p-1$ for $p$ to divide $x+1$.

It follows that $r=1$ and $a=2$. If $p \geqslant 5$, we obtain

$$
p^{a}=x^{p-1}+y>(p-1)^{4}=\left(p^{2}-2 p+1\right)^{2}>(3 p)^{2}>p^{2}=p^{a}
$$

a contradiction. So the only case that remains is $p=3$, and indeed $x=2$ and $y=p^{a}-x^{p-1}=5$ satisfy the conditions.
Again, we can focus on the case that $p>2$. If $p \mid x$, then also $p \mid y$. In this case, let $p^{k}$ and $p^{\ell}$ be the highest powers of $p$ that divide $x$ and $y$ respectively, and assume without loss of generality that $k \leqslant \ell$. Then $p^{k}$ divides $x+y^{p-1}$ while $p^{k+1}$ does not, but $p^{k}<x+y^{p-1}$, which yields a contradiction. So $x$ and $y$ are not divisible by $p$. FERMAT's little theorem yields $0 \equiv x^{p-1}+y \equiv 1+y(\bmod p)$, so $y \equiv-1(\bmod p)$ and for the same reason $x \equiv-1(\bmod p)$.

In particular, $x, y \geqslant p-1$ and thus $x^{p-1}+y \geqslant 2(p-1)>p$, so $x^{p-1}+y$ and $y^{p-1}+x$ are both at least equal to $p^{2}$. Now we have

$$
x^{p-1} \equiv-y \quad\left(\bmod p^{2}\right) \quad \text { and } \quad y^{p-1} \equiv-x \quad\left(\bmod p^{2}\right)
$$

These two congruences, together with the EulER-FERMAT theorem, give us

$$
1 \equiv x^{p(p-1)} \equiv(-y)^{p} \equiv-y^{p} \equiv x y \quad\left(\bmod p^{2}\right)
$$

Since $x \equiv y \equiv-1(\bmod p), x-y$ is divisible by $p$, so $(x-y)^{2}$ is divisible by $p^{2}$. This means that

$$
(x+y)^{2}=(x-y)^{2}+4 x y \equiv 4 \quad\left(\bmod p^{2}\right)
$$

so $p^{2}$ divides $(x+y-2)(x+y+2)$. We already know that $x+y \equiv-2(\bmod p)$, so $x+y-2 \equiv$ $-4 \not \equiv 0(\bmod p)$. This means that $p^{2}$ divides $x+y+2$.

Using the same notation as in the first solution, we subtract the two original equations to obtain

$$
p^{b}-p^{a}=y^{p-1}-x^{p-1}+x-y=(y-x)\left(y^{p-2}+y^{p-3} x+\cdots+x^{p-2}-1\right) .\tag{1}
$$

The second factor is symmetric in $x$ and $y$, so it can be written as a polynomial of the elementary symmetric polynomials $x+y$ and $x y$ with integer coefficients. In particular, its value modulo



$p^{2}$ is characterised by the two congruences $x y \equiv 1\left(\bmod p^{2}\right)$ and $x+y \equiv-2\left(\bmod p^{2}\right)$. Since both congruences are satisfied when $x=y=-1$, we must have

$$
y^{p-2}+y^{p-3} x+\cdots+x^{p-2}-1 \equiv(-1)^{p-2}+(-1)^{p-3}(-1)+\cdots+(-1)^{p-2}-1 \quad\left(\bmod p^{2}\right)
$$

which simplifies to $y^{p-2}+y^{p-3} x+\cdots+x^{p-2}-1 \equiv-p\left(\bmod p^{2}\right)$. Thus the second factor in (1) is divisible by $p$, but not $p^{2}$.

This means that $p^{a-1}$ has to divide the other factor $y-x$. It follows that

$$
0 \equiv x^{p-1}+y \equiv x^{p-1}+x \equiv x(x+1)\left(x^{p-3}-x^{p-4}+\cdots+1\right) \quad\left(\bmod p^{a-1}\right) .
$$

Since $x \equiv-1(\bmod p)$, the last factor is $x^{p-3}-x^{p-4}+\cdots+1 \equiv p-2(\bmod p)$ and in particular not divisible by $p$. We infer that $p^{a-1} \mid x+1$ and continue as in the first solution.

Final answer: $(p, x, y) \in\{(3,2,5),(3,5,2)\} \cup\left\{\left(2, n, 2^{k}-n\right) \mid 0<n<2^{k}\right\}$