MathLabs

Problem 5

Find all triples (a,b,p)(a,b,p) of positive integers with pp prime and ap=b!+pa^p=b!+p
Step 1 of 6: Bound bb using pp-adic valuation and Wilson's theorem
In plain words

If b!b! already contains two factors of pp, then b!+pb!+p has exactly one factor of pp, which a perfect pp-th power can never have.

b≤2p−2b\le2p-2
Detailed analysis

If b≥2pb\ge2p, then p2∣b!p^2\mid b!, so vp(b!+p)=1v_p(b!+p)=1, which is impossible for the perfect pp-th power apa^p. The case b=2p−1b=2p-1 is ruled out separately: (2p−1)!+p=p[(p−1)!(p+1)(p+2)⋯(2p−1)+1](2p-1)!+p=p\big[(p-1)!(p+1)(p+2)\cdots(2p-1)+1\big], and Wilson's theorem shows the bracket is ≡2(modp)\equiv2\pmod p for p>2p>2, contradicting divisibility by pp again; for p=2p=2, 3!+2=83!+2=8 is not a perfect square. Hence b≤2p−2b\le2p-2.