IMO 2022 · Problem 5

Find all triples \((a,b,p)\) of positive integers with \(p\) prime and \[ a^p=b!+p. \]

Official text of the problem. Official problem paper (PDF)

Answer

The only triples are \[ \boxed{(a,b,p)=(2,2,2)\quad\text{and}\quad(3,4,3).} \]

Solution

Since \(a^p=b!+p\ge3\), we have \(a\ge2\).

First, we prove that \(b\ge p\). Suppose instead that \(b<p\). If \(a\le b\), then \(a\mid b!\), so the equation implies \(a\mid p\). As \(p\) is prime and \(a\ge2\), this gives \(a=p>b\), a contradiction. Thus \(a>b\), and consequently \[ b!<a^b\le a^{p-1}. \] It follows that \[ p=a^p-b!>a^{p-1}(a-1)\ge2^{p-1}\ge p, \] which is impossible. Here the last inequality follows from the binomial theorem: \[ 2^{p-1}=(1+1)^{p-1}\ge1+(p-1)=p. \] Therefore \(b\ge p\).

Since \(p\mid b!\), the equation now implies \(p\mid a\). If \(b\ge2p\), then \(p^2\mid b!\); also \(p^2\mid a^p\), because \(p\mid a\) and \(p\ge2\). This would give \(p^2\mid p\), a contradiction. Hence \[ p\le b<2p. \]

We next prove that \(a=p\). Pairing the factors of \((2p-1)!\), we obtain \[ (2p-1)! =p\prod_{i=1}^{p-1}i(2p-i) <p\prod_{i=1}^{p-1}p^2 =p^{2p-1}, \] because \(i(2p-i)=p^2-(p-i)^2<p^2\). Thus \[ a^p=b!+p \le(2p-1)!+p <p^{2p-1}+p \le2p^{2p-1} \le p^{2p}, \] so \(a<p^2\).

Write \(a=pc\), where \(1\le c<p\). Since \(c\le b\), we have \(c\mid b!\); also \(c\mid a^p\). Therefore \(c\mid p\). As \(p\) is prime and \(c<p\), we conclude that \(c=1\), proving \(a=p\). Our equation becomes \[ b!=p\bigl(p^{p-1}-1\bigr). \tag{1} \]

We now rule out every prime \(p\ge7\). For such \(p\), \[ p!+p\le p^{p-1}+p<2p^{p-1}<p^p. \] Thus \(b=p\) is impossible, and hence \(b\ge p+1\).

The four integers \[ 2,\qquad \frac{p-1}{2},\qquad p-1,\qquad p+1 \] are distinct and belong to \(\{1,\ldots,b\}\). Their product therefore divides \(b!\), giving \[ (p-1)^2(p+1)\mid b!. \] Since \(p\) is relatively prime to \((p-1)^2(p+1)\), equation (1) implies \[ (p-1)^2(p+1)\mid p^{p-1}-1. \tag{2} \]

Set \(m=(p-1)/2\). Factoring, \[ p^{p-1}-1 =(p^2-1)\left(1+p^2+p^4+\cdots+p^{2(m-1)}\right). \] As \((p-1)^2(p+1)=(p-1)(p^2-1)\), divisibility (2) requires \[ p-1\mid 1+p^2+p^4+\cdots+p^{2(m-1)}. \] But \(p\equiv1\pmod{p-1}\), so the sum on the right is congruent to \[ m=\frac{p-1}{2}\not\equiv0\pmod{p-1}. \] This contradiction excludes all \(p\ge7\).

It remains to consider \(p=2,3,5\), with \(a=p\).

  • If \(p=2\), then \(b!=2^2-2=2\), so \(b=2\).
  • If \(p=3\), then \(b!=3^3-3=24\), so \(b=4\).
  • If \(p=5\), then \(b!=5^5-5=3120\), which is impossible because \[ 6!=720<3120<5040=7!. \]

Finally, \[ 2^2=2!+2,\qquad 3^3=4!+3, \] so both listed triples satisfy the equation.

The solution was checked against the official IMO shortlist solutions.