My teacher in Math Team gave the following question to us.

Solve $$a!b!=a!+b!+c!$$ where $a$, $b$ and $c$ are nonnegative integers.

I found only one solution by trial and error and it is $(a,b,c)=(3,3,4)$.

Any help is appreciated!

  • 5
    $\begingroup$ This was BMO 2002/3 Round 1 Problem 5. $\endgroup$ – J.G. Aug 6 at 7:28
  • $\begingroup$ Did your teacher in Math Team tell you it was OK to farm the question out to the internet? $\endgroup$ – Gerry Myerson Aug 7 at 6:33
  • $\begingroup$ He just told us to find the solution. $\endgroup$ – Culver Kwan Aug 7 at 9:11
  • $\begingroup$ Fair enough. But I hope you'll acknowledge your sources when you turn your work in. $\endgroup$ – Gerry Myerson Aug 7 at 12:52

A sketch:

There is no solution with $a\lt2$ (this would imply $c!=-1$) or $a=2$ (this would imply $b!-c!=2$), so by symmetry $a,\,b\ge3$. Without loss of generality $a\ge b$. Since$$a!=\frac{a!}{b!}+1+\frac{c!}{b!}$$is an integer, $c\ge b$.

In the case $a=b$, $b!=2+\frac{c!}{b!}$ is a multiple of $3$, so $c\in\{b,\,b+1,\,b+2\}$. These subcases equate $b!$ to a polynomial in $b$, so only small $b$ can be solutions.

In the case $a>b$, since $b!=1+\frac{b!}{a!}+\frac{c!}{a!}$ is an integer, $a>c\ge b$. The above display-line equation also tells us $\frac{a!}{b!},\,\frac{c!}{b!}$ aren't both multiples of $3$, so $c\in\{b,\,b+1,\,b+2\}$. We can exhaust these using $a!\ge 24,\,b!\ge6$. The case $c=b$ gives $b!=\frac{a!}{a!-2}$, which gives no solutions; $c=b+1$ gives $b!=\frac{a!}{a!-b-2}$, while $c=b+2$ gives $b!=\frac{a!}{a!-b^2-3b-3}$.

  • $\begingroup$ Can you add the case $a>b$? Or I can't accept your answer. $\endgroup$ – Culver Kwan Aug 7 at 4:46
  • $\begingroup$ @CulverKwan That's just rude - he gave you the shortest (and arguably the best ) solution and you can't accept the answer??? There are also 2 similar answers above and you can't even be bothered to acknowledge the efforts of the authors? $\endgroup$ – asdf Aug 7 at 6:38
  • $\begingroup$ I've edited my answer as requested, but it's still just a sketch. $\endgroup$ – J.G. Aug 7 at 7:33
  • 1
    $\begingroup$ @asdf Thank you for defending me, but I do think it's fair to say answer acceptance required the case $a>b$. $\endgroup$ – J.G. Aug 7 at 7:33

Let $x,y,z$ be the highest powers of $2$ that divide $a!, b!$ and $c!$, respectively.Then $x+y$ is the highest power of $2$ that divides $a!b!$.

Also, since you clearly have that $$(a!-1)(b!-1)=c!+1$$ you can obtain that $c>a$ and $c>b$ (apart from some small values of $a,b,c$ which you've probably already ruled out using direct check)

We can now assume WLOG that $a\leq b \leq c$. Then we have:

$$a!+b!+c!=2^xa_1+2^yb_1+2^zc_1=2^x(a_1+2^{y-x}b_1+2^{z-x}c_1)$$ where $a_1,b_1$ and $c_1$ are odd numbers.

Since trivially $x<x+y$ and $2^{x+y}|\text{LHS}$ then we must have that $a_1+2^{y-x}b_1+2^{z-x}c_1$ is even.

If now you assume that $x\neq y$ then $2^{y-x}b_1$ is even, hence we must have $z=x$, i.e. that $c-a=0$ or $c-a=1$ which implies that

$$(a!)^2\leq a!b!\leq a!+(a+1)!+(a+1)!$$ and that can hold for only small values of $a$ again.

Hence, we must have that $x=y$ hence $b-a=0$ or $b-a=1$.

If $b-a=0$ then we have $$(a!)^2=2a!+c!.$$ As @J.G. showed, this is equivalent to

$$a!=2+\frac{c!}{a!}$$ hence $c-a=0, 1 \text{ or } 2$ and it reduces to a check for small values.

Finally, if $b-a=1$ then you have $$(a!)^2(a+1)=a!(a+2)+c!$$ which is equivalent to


Now, (unless $c=a$ which again reduces for to small values of a) we have that $a+1| \text{ LHS }$, and $a+1| \frac{c!}{a!}$, hence $a+1|a+2$ which is a contradiction.

Hopefully there aren't any mistakes, though you will have to fill in the gaps, namely do the small values checks.


I claim that $a=b$ or $a=c$. For the sake of this problem, assume $b \geq a$ (proving for $b \leq a$ is the exact same). Then $$b!=1+\frac{b!}{a!}+\frac{c!}{a!}.$$ Due to closure of the integers under addition/subtraction, we get that $c\geq a$.

Case 1: ($b \leq c $)

If $b \leq c$, then $$b!-1=\frac{b!}{a!}+\frac{c!}{a!}=(\frac{c!}{b!}+1)\frac{b!}{a!}.$$ But $b> a$ implies that $b|(b!-1)$, a contradiction, so $b=a$. Then this equates to solving $(a!)^2=2a!+c!$ or $a!(a!-2)=c!$. For $a\geq 3$, clearly $3 \not|(a!-2)$, so $c=a+1$ or $c=a+2$ (else $c = (a+3)(a+2)(a+1)\dots $ has $3$ as a factor). The equation $a!(a!-2)=(a+1)!$ has one solution at $a=3$ and the equation $a!(a!-2)=(a+2)!$ has none. Then the only solution of this form is $(a,b,c)=(3,3,4)$.

Case 2: ($b>c$)

If $b>c$, then $$b!-1=\frac{b!}{a!}+\frac{c!}{a!}=(\frac{b!}{c!}+1)\frac{c!}{a!}$$

Because $c<b$, $[c(c-1)(c-2)\dots(c-a+1)] |b!$, whence $[c(c-1)(c-2)\dots(c-a+1)]\not| (b!-1)$ for $c > a$. It follows that $c=a$, which then equates to solving $$a!b!=2a!+b!$$ Rearranging both sides gets $a!(b!-2)=b!$, which has no solutions because $b!/(b!-2)$ doesn't take an integer value for $b \geq 3$. Then there are no solutions of the form $(a,b,c) = (a,b,a)$.


From all of this, we get that $(3,3,4)$ is the only solution to $a!b! = a!+b!+c!$. (Note that I used guessing and checking to prove that $a,b,c > 2$)

  • $\begingroup$ In your "Case 2:", you state $b \lt c$ in the title & the start of the first paragraph. However, this is almost the same as "Case 1:" (apart from the equal). I believe you meant it to say $c \lt b$ instead, e.g., as your second paragraph starts with "Because $c \lt b$, ...". $\endgroup$ – John Omielan Aug 7 at 2:46
  • $\begingroup$ @JohnOmielan ah you are right $\endgroup$ – Hyperion Aug 7 at 6:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.