This is the IMO 2022 number theory problem. Find all positive integer triplets $(a,b,p)$ such that: $$a^{p} = b! + p$$ where $p$ is prime.
If the solution is uploaded by the official IMO website, I am hoping to get a different solution that.
Attempt:
Notice $a^{p} \ge 4$.
When $a=2$ then, it seems, that the only solution is $(2,2,2)$ (I tried up to $p=11$ no other solution).
When $a=3$, I found a solution $(3,4,3)$.
When $a=4$, if $b!=1$ then by Fermat's we have $4^{p} \equiv 4 \mod p$ which means $(b!=1) \equiv 4 \mod p$, which means $p=3$, but contradiction. If $b! > 1$, then $b!$ is even, so $p$ must also be even, which means $4^{2} = b! + 2$, and we don't have solution. So no solution when $a=4$.
When $a=6$, if $b!=1$ then by Fermat's we have $6^{p} \equiv 6 \mod p$ which means $(b!=1) \equiv 6 \mod p$, so $p=5$, but this is contradiction. If $b!>1$, which is even, then $p$ must also be even, $p=2$, so $b! = 6^{2} - 2 = 34$ which has no solution for $b$.
In general if $a \ge 8$ is even, if $b!=1$ then by Fermat's we have $a^{p} \equiv a \mod p$ which means $(b!=1) \equiv a \mod p$, so $p \le a-1$, which means $a^{p} = 1 + p \le a$, a contradiction. If $b!>1$, which is even, then $p$ must also be even, $p=2$, so $b! = a^{2} - 2$. So $a^{2} = b! + 2$, but $b! + 2$ can only be divided by $2$ and itself. While $a^{2} \ge 64$, can be divided by 2, $a$, and itself. So there is no solution.
Another way we may want to use Combinatorial argument to show $b!=a^{2}-2$ has no solution. Combinatorial argument: We have $b$ soldiers and $2$ generals, which they decide to go forth either by an army of $b$ soldiers on a straight line, OR, 1 general fighting alone. So the number of possibilities is $b! + 2$. How can we relate this to a square number?