[Math] Find the number of pairs of positive integers $(a, b)$ such that $a!+b! = a^b$

combinatoricscontest-mathnumber theory

How many pairs of positive integers $(a, b)$ such that $a!+b! = a^b$?

A straight forward brute-force reveals that $(2,2)$ and $(2,3)$ are solutions and this seems to be the only possible solutions, I was just wondering how could we prove this.

Best Answer

We first show that $a \leq b$.

Assume by contradiction that $a >b$. Then

$$a^b=b!( a(a-1)...(a-b+1) +1) \,.$$

Thus $a(a-1)...(a-b+1) +1 | a^b$. But $gcd(a,a(a-1)...(a-b+1) +1)=1$ thus $gcd(a^b,a(a-1)...(a-b+1) +1)=1$. This shows that $a(a-1)...(a-b+1) +1=1$ which is not possible since $a>b$.


We now prove that $a \leq 2$.

Since $a \leq b$ than $a!| a!+b!=a^b$.

Assume by contradiction that $a > 2$. Then, by Bertrand Postulate, there exists a prime $p$ so that $p|a!$ and $p$ doesn't divide $a$. Hence $p|a!$ but $p$ doesn't divide $a^b$, contradiction.

We proved that $a=2$, now the rest is easy.