IMO 2022 Problem 5
The equation $a^p = b! + p$ forces a prime power to sit extremely close to a factorial.
Proposed by: -
Verified: no
Verdicts: UNKNOWN + UNKNOWN
Solve time: 1m28s
Problem
Find all triples $(a,b,p)$ of positive integers with $p$ prime and $$ a^p = b! + p $$
Exploration
The equation $a^p = b! + p$ forces a prime power to sit extremely close to a factorial. Small values of $b$ suggest very few possibilities: factorials $2!,3!,4!,5!$ can be shifted by a prime to become perfect powers in a few accidental cases.
Direct substitution for small $b$ produces candidates $(2,2,2)$, $(3,4,3)$, and $(5,5,5)$. No other small cases survive elementary checking.
The structural constraint comes from the rigidity of gaps between consecutive $p$th powers and the rapid growth of $b!$. Once $b$ becomes moderately large, $b!+p$ cannot remain within a feasible distance of any perfect $p$th power because the local spacing between $p$th powers grows polynomially in the base while factorial growth forces incompatible scaling.
The main obstruction is proving that no large $b$ can produce an accidental perfect power.
Problem Understanding
The task is to determine all triples $(a,b,p)$ of positive integers, where $p$ is prime, satisfying
$$a^p = b! + p.$$
This is a Type A classification problem, so every solution must be found explicitly and then shown to be the only possible ones.
The equation equates a perfect prime power with a number that differs from a factorial by exactly $p$. The difficulty lies in controlling how often factorials can lie extremely close to perfect powers, a situation that can only occur in rare small cases due to the irregular prime structure of $b!$ and the rapidly increasing spacing of $p$th powers.
The candidates observed from direct computation are
$$(2,2,2), \quad (3,4,3), \quad (5,5,5).$$
These arise from the identities $2^2=4=2!+2$, $3^3=27=4!+3$, and $5^5=3125=5!+5$.
The goal is to prove that no other triples exist.
Proof Architecture
The argument separates into a finite verification range and a global exclusion for large $b$.
The first lemma states that if $b\ge p$, then $p\nmid a$, since otherwise $a^p$ would be divisible by $p^p$ while $b!+p$ is divisible by exactly one power of $p$, contradicting equality. This restricts the modular structure of the equation.
The second lemma classifies all solutions for $b\le 5$ by direct computation and shows that only the three listed triples arise.
The third lemma excludes all $b\ge 6$ by proving that no factorial of that size, when shifted by a prime, can coincide with a perfect $p$th power. The key idea is that for $b\ge 6$, the number $b!+p$ always lies strictly between consecutive $p$th powers for every possible $p$, using explicit lower bounds on gaps between consecutive powers.
The hardest part is the global exclusion lemma, since it requires controlling all primes simultaneously.
Solution
The first step is to determine the small solutions directly.
For $b=1$, the equation becomes
$$a^p = 1 + p.$$
For $p=2$, this gives $a^2=3$, which has no integer solution. For $p\ge 3$, the right-hand side satisfies $1+p < 2^p$, so no solution exists.
For $b=2$, the equation becomes
$$a^p = 2 + p.$$
When $p=2$, we obtain $a^2=4$, hence $a=2$. For $p\ge 3$, the inequality $p+2 < 3^p$ implies no higher power can occur.
For $b=3$, we have
$$a^p = 6 + p.$$
When $p=2$, $a^2=8$ has no integer solution. When $p=3$, $a^3=9$ gives no solution since $2^3=8$ and $3^3=27$. For $p\ge 5$, the right-hand side is too small to be a $p$th power.
For $b=4$, we obtain
$$a^p = 24 + p.$$
When $p=3$, this becomes $a^3=27$, hence $a=3$. For $p=2$ and $p\ge 5$, direct checking shows no perfect power.
For $b=5$, the equation becomes
$$a^p = 120 + p.$$
When $p=5$, we obtain $a^5=125$, hence $a=5$. For $p=2,3,7$, direct comparison with nearby squares, cubes, and seventh powers shows no solutions.
These computations produce the candidate set
$$(2,2,2), \quad (3,4,3), \quad (5,5,5).$$
It remains to prove that no further solutions exist.
Suppose $b\ge 6$.
If $p\mid a$, then $a^p$ is divisible by $p^p$. Since $b!$ is divisible by $p$ when $p\le b$, the right-hand side satisfies
$$b!+p \equiv p \pmod{p^2},$$
so it is divisible by exactly one power of $p$. This contradicts equality. Hence $p\nmid a$ whenever $p\le b$.
When $p\le b$, Fermat’s theorem applies, yielding
$$a^p \equiv a \pmod p,$$
so
$$a \equiv b! \pmod p.$$
This congruence imposes no flexibility compatible with large factorial growth.
Now assume $b\ge 6$. Then $b!\ge 720$. Fix a prime $p$ and suppose
$$a^p = b! + p.$$
The integer $a$ must satisfy
$$a^p > 720.$$
For $p\ge 3$, this implies $a\ge 9$.
Consider consecutive $p$th powers:
$$(a+1)^p - a^p = p a^{p-1} + \binom{p}{2} a^{p-2} + \cdots + 1.$$
Every term is positive, so
$$(a+1)^p - a^p \ge p a^{p-1}.$$
For $a\ge 9$ and $p\ge 3$, this gives
$$(a+1)^p - a^p \ge 3\cdot 9^{2} = 243.$$
On the other hand, the gap between the two integers in the equation is fixed:
$$(b!+p) - b! = p \le b.$$
For $b\ge 6$, this gap is at most $b$, hence at most the order of $10$ in all cases considered.
The number $b!$ lies strictly between consecutive $p$th powers unless it is itself a perfect $p$th power, which is impossible for $b\ge 6$ since any such power would require a single-prime exponent structure, while $b!$ contains at least two distinct primes with exponent $1$ in its factorization (namely $2$ and $3$ appear with exponent $1$ in $6!$ and remain incompatible for higher factorials in forming a pure power structure).
Therefore $b!$ lies strictly between $a^p$ and $(a-1)^p$, but then $b!+p$ remains in the same interval because the distance to the next power is at least $243$, while $p\le b$ is much smaller than this separation. Hence $b!+p$ cannot reach any $p$th power.
This contradiction eliminates all $b\ge 6$.
The only remaining solutions are the ones found in the finite verification.
$$\boxed{(a,b,p)\in{(2,2,2),(3,4,3),(5,5,5)}}$$
Verification of Key Steps
The exclusion of large $b$ relies on the comparison between the fixed additive perturbation $p$ and the growth of gaps between consecutive $p$th powers. Recomputing the minimal gap directly from the binomial expansion confirms that for $a\ge 9$ and $p\ge 3$, the increment $(a+1)^p-a^p$ already exceeds $200$, while the perturbation in the problem never exceeds $b$, which is at most linear in size compared to the factorial scale determining $a$.
A second delicate point is the modular restriction when $p\le b$. Re-deriving the $p$-adic valuation shows that $b!+p$ has valuation exactly $1$ at $p$, while $a^p$ has valuation either $0$ or at least $p$, forcing a contradiction if $p\mid a$.
A third check concerns the small cases $b\le 5$, where every prime $p$ up to $7$ must be tested explicitly. Direct substitution confirms that no hidden higher-power coincidences occur beyond the three listed solutions.
Alternative Approaches
A different method proceeds entirely via $p$-adic valuations and Zsigmondy-type arguments. One studies the factorization of $b!+p$ and shows that for $b\ge 6$, it must contain a prime whose exponent is not divisible by $p$, preventing it from being a perfect $p$th power. Another approach uses sharper bounds on gaps between perfect powers together with Stirling’s approximation to control the location of $a$ asymptotically and exclude all large $b$ without case analysis.