Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The equation is $(x!)(y!) = x!+y!+z! $

where $x,y,z$ are natural numbers.

How to find out them all?

share|cite|improve this question
Another post about the same question:… – Martin Sleziak Jan 18 at 20:26
up vote 4 down vote accepted

Here's a start. We may assume $x\le y$. The case $x=1$ is trivial. The case $x=2$ gives $y!=z!+2$, which obviously has no solution. So assume $x\ge3$. Then $x!+z!\ge5y!$, so $z!\ge4y!$, so $z\gt y$. Suppose there is a prime number $p$ with $x\lt p\le y$. Then $p$ divides $y!$ and $z!$ but not $x!$ so we get a contradiction from $x!=x!y!-y!-z!$. So we have shown that if $x\le y$ then there can't be a prime $p$ with $x\lt p\le y$.

share|cite|improve this answer
I think let $p=3y!$ in your prove, all things are done. p is not necessary a prime. – Leitingok Dec 6 '11 at 8:34
I don't understand. It is not true that $3y!\le y$, and it is not true that $3y!$ divides $y!$. – Gerry Myerson Dec 6 '11 at 12:33
Hi, Gerry. I think your argument gives the whole thing. I've seen arguments of this sort, using the $\mbox{ord}_p (n)$ I defined, in contest books. – Will Jagy Dec 6 '11 at 18:44
Well, my argument (or Ross Millikan's) together with your not-the-least-bit-trivial contribution. – Gerry Myerson Dec 7 '11 at 3:19
Thank you Gerry. – Will Jagy Dec 7 '11 at 3:38

There won't be very many as the factorials are very sparse. I suspect you have already listed them all. We can assume $x \le y$. If $x!=1$ the RHS is at least $2$ greater than the left. If $x!=2, y=z$ the RHS is $2$ greater than the left, but there are no factorials with a difference of $2$. If $x! \ge 6$, divide both sides by $y!$. The LHS is an integer while the RHS is not unless $x=y$. Now you are looking for solutions to $(x!)^2=2(x!)+z!$

share|cite|improve this answer
You might want to take a look at the solution I just posted (prompted by the posting of a duplicate, linked to in a comment below the OP here). – Barry Cipra Jan 18 at 21:24

Gerry's argument shows, for $3 \leq x \leq y < z,$ that in fact $x=y.$ Otherwise, if we assume $y \geq x+1,$ there is some prime $p | (x+1),$ which might be $x+1$ itself or might be smaller. Suppose we define $\mbox{ord}_p (n)$ to be the largest exponent $k$ such that $p^k | n.$ We have $\mbox{ord}_p (y!) \geq 1 + \mbox{ord}_p (x!), $ also $\mbox{ord}_p (z!) \geq 1 + \mbox{ord}_p (x!).$ Indeed, we have a contradiction, since $ x! = x! y! - y! - z!,$ and everything on the right hand side is divisible by $p^{1 + \mbox{ord}_p (x!)}.$

Alright, so $$x=y.$$ We do, indeed, have the solution $x=3, y=3, z=4.$

If $x \geq 4,$ then $\mbox{ord}_2 (x!) \geq 3.$ From $x=y$ we have $ (x!)^2 = 2 x! + z!.$ Now, $\mbox{ord}_2 (x!)^2 \geq 3 + \mbox{ord}_2 (x!),$ while $\mbox{ord}_2 2(x!) = 1 + \mbox{ord}_2 (x!).$ As a result, $\mbox{ord}_2 (z!) = 1 + \mbox{ord}_2 (x!).$ We cannot have $ z \geq x + 4$ because then there would be two extra even numbers dividing $z!.$ So $$ z \leq x + 3.$$

However, Stirling's formula shows that, for $x \geq 6, \; z > x + 3$ where we regard $z$ as a real number here. Indeed, for the next few integral $x,$ we get the real solutions $ (4,4,5.833), \; (5,5,7.504), \; (6,6,9.156), \; (7,7,10.814), \; (8,8,12.480), \; (9,9,14.154).$ Stirling's gives me $$ z > \; 2 x \; \left( 1 - \frac{\log 2}{\log x} \right) $$

The only solution in natural numbers is $(x=3, \; y=3, \;z=4)$

ADDED: the function I have been calling $\mbox{ord}_p (n)$ is called $v_p(n)$ in Problems from the Book by Titu Andreescu and Gabriel Dospinescu, available at AOPS or XYZ

EDIT, December 8::This is sensible notation, as the function $v_p$ is the "$p$-adic valuation," see page 25, Definition 2.1.2, of $p$-adic Numbers by "Fernando Q. Gouvea," that being one of the pen-names of Mariano Suárez-Alvarez. Mariano wanted to include a letter "i" somewhere in the last name, have the full set, but was told that would seem inauthentic. P_ADIC_BOOK

share|cite|improve this answer
Pushing the maximum on edits. $v_p$ is good notation in English, I am not sure what Hensel wrote. Also, 'i' for the full set of vowels. About Fernando and Mariano, see… and… – Will Jagy Dec 8 '11 at 22:01

Without loss of generality, we can assume $x\le y$. We can quickly rule out any solution with $x=1$ or $2$, since the equations

$$y!=1+y!+z!\quad\text{and}\quad 2y!=2+y!+z!$$

are easily seen to have no solutions in positive integers $y$ and $z$.

Now suppose we had a solution with $x\lt y$. Then

$$x!={x!\over y!}+1+{z!\over y!}\implies{z!\over y!}=x!-1-{x!\over y!}\not\in\mathbb{N}$$

hence $z\lt y$ as well. But that implies $x!\lt1+1+1=3$, which implies $x=1$ or $2$, which have already been ruled out. Hence any solution must have $x=y\ge3$.

Now suppose we have a solution with $x=y\ge3$. The equation can now be written as

$$x!-2={z!\over x!}$$

which implies $z\ge x$. We can rule out $z=x$ since $x!$ cannot equal $3$, so we have


But $x\ge3$ implies $x!-2\equiv1$ mod $3$, and this implies the product $(x+1)(x+2)\cdots(z-1)z$ can only be $x+1$ (with $x\equiv0$ mod $3$) -- that is, any product of two or more consecutive numbers is either divisible by $3$ or leaves remainder $2$ mod $3$. Thus any solution $(x,y,z)$ must be of the form $(x,x,x+1)$, satisfying the equation


which simplifies to


which has $x=3$ as its only solution. So $(x,y,z)=(3,3,4)$ is the only solution to $x!y!=x!+y!+z!$.

share|cite|improve this answer
Got your comment. This is very nice. It helps to know that something is likely a contest type problem; I keep asking people for the source of their question, and getting little cooperation. Today I have this bit of joy:… – Will Jagy Jan 18 at 23:01

Observe that $x, y, z > 2$. Obviously, $y < z$. By symmetry, assume $x \leqslant y$. Then, we have $x \leqslant y < z$. Let $x = y$. Then, $$x! = 2 + z! / x!.$$ Let $k = z - x > 0$, so the last equality becomes $$x! = 2 + (x + 1) (x + 2) \cdots (x + k).$$ Since $x | x!$, we should have $x | k! + 2$. If $k \geqslant x$, then, we get $x | 2$, which is impossible. Hence $k < x$. This is only possible when $k = 1$, in which case we have $x | 3$. Hence, $x = 3$, therefore, $y = 3$ and $z = 4$.

Now suppose $x < y < z$. Let $\alpha$, $\beta$ and $\gamma$ be the largest powers of $2$ that divide $x!$, $y!$ and $z!$, respectively. Then, $$\alpha + \beta = \min (\alpha, \beta, \gamma)$$ by the original equation, since $x, y, z$ are distinct. But this is impossible since $\alpha, \beta, \gamma > 0$.

Hence, the only solution is $(x, y, z) = (3, 3, 4)$.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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