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

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.

-

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.

-

It is clear that there are no solutions if $a=1$ or $b=1$. Any solution must be such that $a\ge2$ and $b\ge2$; this implies in particular that $a$ must be even.

Fact 1 . If $a=2$, there exist solutions with $b=2$ and $b=3$; there are no solutions with $b\ge4$.

Proof. If $2+b!=2^b$ with $b\ge4$, then $4$ divdes $b!$ and $2^b$, but not $2$.

Fact 2. If $b=2$, the only solution is $a=2$.

Proof. If $a!+2=a^2$ with $a\ge3$, then $a^2\equiv2\pmod3$, but $2$ is not a quadratic residue modulo $3$.

From now on we assume that $a\ge4$ is even, $b\ge3$ and $a!+b!=a^b$.

For a positive integer $a$ define $$\nu(a)=\min\{p\text{ prime}:p\le a,\ p\not\mid a\}.$$ For instance $\nu(6)=5$ and $\nu(10)=3$.

Fact 3. $b<\nu(a)$.

Proof. If $b\ge\nu(a)$, then $\nu(a)\mid a!$, $\nu(a)\mid b!$ and $\nu(a)\mid a!+b!=a^b$, in contradiction with the definition of $\nu(a)$.

Fact 4. $6\mid a$.

Proof. If $3\not\mid a$, then $\nu(a)=3$, so that $b\le2$. But there are no solutions with $b=2$ other than $a=2$.

Fact 5. There are no solutions with $a=6$.

Proof. It is an easy calculation, since we have to check only $3\le b<5$.

From now on we assume that $6\mid a$, $a\ge12$, $b\ge3$ and $a!+b!=a^b$.

Fact 6. $b>0.59\,a$.

Proof. We know from Stirling's formula that $\log a!>a\log a-a$. Taking logarithms in the equation $a!+b!=a^b$ we get $b<(1-1/\log a)a$. Since $a\ge12$, $1-1/\log a\ge0.59$.

Up to now we have shown that $0.59\,a<b<\nu(a)$. All is left is

Fact 7. $\nu(a)\le a/2$.

Proof. Let $p$ be the largest prime dividing $a$. If $p=3$, then $\nu(a)=5<a/2$. If $p>3$, then $a\ge12\,p$. Let $q$ be the smallest prime larger than $p$. Then $\nu(a)\le q<2\,p\le a/6$.

Fact 8. There must be a simpler way.

Proof. ?

-
+1, on the interesting approach and mostly on Fact 8! – NoChance Feb 5 '12 at 21:44

Given:

$1\cdot2\cdot3\cdot...a + 1\cdot2\cdot3\cdot...b = a\cdot a\cdot a...$

Case $b>=a$:

$= a! + a!\cdot \frac {b!}{a!} = a!\cdot(1+\frac {b!}{a!})$

Case $a>=b$:

$= b! + b!\cdot \frac {a!}{b!} = b!\cdot(1+\frac {a!}{b!})$

Prime factorization shows the need for $a$ to be less than 5.

That is, given that $a!$ or $b!$ is a factor of $a$, and that $x!$ has every prime factor less than or equal to $x$, $a$ contains every prime factor less than or equal to $a$ or $b$. If $b>=a$ then the only case for which $a$ contains all the prime factors of $a!$ is $a=a!$.

In the latter case, $a!$ diverges far too quickly for $a^b$ to even be in the same ballpark. For example, $b=5$ gives $a>=30$ which implies $a!$ is more than 25 orders of magnitude larger than $a^b$.

-
Can you please elaborate on "Prime factorization clearly shows the need for a to be equal to either a! or b!" ? – the L Feb 5 '12 at 11:53
But what if that largest prime factor of $b!$ also divides $1+\frac{a!}{b!}$? For example, when $b=3$ and $a=5$, then $3$ is the largest prime factor of $3!$ and it also divides $1+\frac{5!}{3!}$..... – N. S. Feb 6 '12 at 6:34
Hat eaten. Thank you sir and would you care to critique my corrections? – user474632 Feb 7 '12 at 23:30

I am hoping to prove the $a\le2$ part of the accepted solution without Bertrand's Postulate . Let

$a>2$ , then $a-1>1$ , so $a-1$ is either prime or composite , in any case , there is a prime $p$ such

that $p|a-1$ so that $p\le a-1<a$ , hence $p|a!$ , and since g.c.d.$(a,a-1)=1$ so $p$ does not divide $a$

Now since $a\le b$ , so from $a!\Big(1+ \dfrac{b!}{a!}\Big)=a!+b!=a^b$ we get , as $p|a!$ , so the left hand side is

divisible by $p$ , hence we should also have $p|a^b \implies p|a$ , contradiction ! So $a\le 2$

-