Erdős Problem 405
Statement and status.
For a fixed odd prime $p$, are there only finitely many positive integers $a$ for which $(p-1)!+a^{p-1}$ is a power of $p$? The stronger classification is known: the solutions $(p,a,k)$ of $(p-1)!+a^{p-1}=p^k$ are $(3,1,1),(3,5,3),(5,1,2)$, by Yu and Liu. The full classification and general finiteness are unresolved in this attempt. Here are complete restrictions and a complete treatment of $p=5$.
Prime-divisor and congruence restrictions.
Let $F=(p-1)!$. If a prime $q<p$ divides $a$, it divides $F+a^{p-1}=p^k$, which is impossible. If $p\mid a$, Wilson's theorem gives $F+a^{p-1}\equiv-1\pmod p$, also impossible. Thus $\gcd(a,p!)=1$.
For $p\geq5$, this makes $a$ odd. Since $8\mid F$ and $a^{p-1}\equiv1\pmod8$, we have $p^k\equiv1\pmod8$. Also $3\mid F$, $3\nmid a$, and $p-1$ is even, so $p^k\equiv1\pmod3$. Consequently, if $k$ is odd, then \[
p\equiv1\pmod{24}.
\tag{1}
\]
All even exponents reduce to a finite search.
If $k=2h$, set $X=p^h$, $Y=a^{(p-1)/2}$. Then \[
(X-Y)(X+Y)=F,\qquad X>Y>0.
\] Every solution comes from a positive factor pair $u<v$, $uv=F$, with equal parity, by $X=(u+v)/2$, $Y=(v-u)/2$. There are only finitely many such pairs, and $X\leq(F+1)/2$. In particular, \[
k\leq2\log_p((F+1)/2).
\] This proves finiteness of the even-$k$ portion for every fixed $p$.
The complete case $p=5$.
Here $a$ is odd and $a^4+24\equiv9\pmod{16}$. The powers of $5\pmod{16}$ are $5,9,13,1$, so $k\equiv2\pmod4$. Thus $k$ is even, and the preceding factorization applies with $F=24$, $Y=a^2$. The positive equal-parity factor pairs $u<v$ of $24$ are $(2,12)$ and $(4,6)$. The first gives $(X,Y)=(7,5)$, which fails both required power conditions. The second gives $(X,Y)=(5,1)$, hence $a=1,k=2$. Indeed $4!+1=25$.
Remaining gap and source.
For $p=3$, the two displayed solutions follow from $1^2+2=3$ and $5^2+2=27$; their exhaustiveness is not proved here. For primes $p\equiv1\pmod{24}$, $1$ leaves an unbounded odd-exponent case untreated. The known full result is Kunrui Yu and Dehua Liu,
A complete resolution of a problem of Erdős and Graham, Rocky Mountain Journal of Mathematics $1996$, 1235--1244,
https://doi.org/10.1216/rmjm/1181072047. Statement checked at
https://www.erdosproblems.com/405 on 24 September 2026.
Completion estimate.
Even exponents and $p=5$ are settled here; the general odd-exponent argument is missing.
COMPLETION: 30%