# Find all non-negative integers $a, b, c ,d$ such that $a! + b! + c! = 2^d$

Find all non-negative integers $$a, b, c ,d$$ such that $$a! + b! + c! = 2^d$$.

By trial I found $$a= 2 , b= 3 , c= 5$$ and $$d= 7$$ which is one solution. How to find all the solutions of it ?

• This problem seems pretty similar. Based off the approach in the video, it may boil down to finding just a few using some logical reasoning about what can and can't happen in this kind of situation. Apr 12 '20 at 7:55
• Hint: Can $a,b,c$ be all greater than $3$? Apr 12 '20 at 8:00
• oh shit i only realised they can't all be greater than 5 @JannikPitt :(( Apr 12 '20 at 8:12

Better version.

Notice that $$3 \mid x!$$ for $$x \geq 3$$ and $$3 \not \mid 2^d$$. Therefore, at least one of $$a, b, c \leq 2$$. WLOG let $$a\leq b\leq c$$.

If $$c\leq 1$$, $$a\leq b\leq c\leq 1, a!=b!=c!=1$$ which gives no solution.

If $$c=2$$, $$a!+b!+2=2^d$$. $$a,b\in \{0,1\}$$ gives $$4$$ solutions, while $$(a,b)=(1,2)$$ and $$(2,2)$$ doesn't give solution.

For the cases below, $$c\geq 3$$.

If $$b\leq 1$$, $$2+c!=2^d$$. Notice that $$2^2|c!$$ for $$c \geq 4$$, so $$c=3$$. This gives $$(a,b,c,d)=(a,b,3,3) \forall a,b\in \{0,1\}$$ (Extreme laziness)

If $$b=2$$, $$a!+2+c!=2^d$$. Note that $$a!=1$$ doesn't give any solution (parity), so $$a=b=2$$. $$4+c!=2^d$$. Noticing that $$2^3\mid c!$$ for $$c \geq 4$$, $$c=3$$. $$(a,b,c)=(2,2,3)$$ doesn't give a solution.

For the cases below, $$c \geq b \geq 3$$. $$2\mid b!+c!$$.

Note that $$a!=1$$ doesn't give a solution. Therefore, $$a=2$$.

$$2+b!+c!=2^d$$. If $$c \geq b \geq 4$$, $$2^3 \mid b!+c!$$. Therefore $$b=3$$ gives $$8+c!=2^d$$. Note that $$c\geq 6$$ means $$2^4 \mid c!$$. Therefore, $$c=4$$ or $$c=5$$. Checking shows both of them work.

Therefore all the solutions:

$$(a,b,c)=(0,0,2),(0,1,2),(1,1,2),(0,0,3),(0,1,3),(1,1,3),(2,3,4),(2,3,5)$$ , up to permutations.

• Thank you, that's what I was looking for. Apr 12 '20 at 8:29

A simplier approach

$$a!+b!+c! = 2^d$$ where $$a,b,c,d€Z$$

Notice that $$2^d$$ must be even, therefore $$a!+b!+c!$$ must also be even..... We know that the factorial of a number must always be even

Therefore $$a!$$, $$b!$$ and $$c!$$ are all even and $$a,b,c > 1$$

Since $$3*x! ≠ 2^d$$, then $$a,b,c$$ can't be equal, therefore $$a < b < c$$

$$even + even + even = even$$

If I sufficiently divide by $$2$$ it breaks down and at some point becomes

$$odd + odd + even = even$$

So to find $$a$$ and $$b$$, we'll look for two factorials that have a common factor of $$2$$ or multiples of $$2$$ and a odd number

$$a!$$ and $$b!$$ can be $$(2!,3!) = (2×1,2×3)$$

It turns out this is the only value that works, because there is no integer that satisfies $$x! = 2^n×y$$ , where $$y$$ is odd

$$2!+3!+c! = 2^d$$

$$8+c! = 2^d$$

Then the range of values of $$c$$ is

$$c = 4,5,......$$

Without loss of generality $$a\le b\le c$$, so $$a!|2^d\implies a!\in\{1,\,2\}$$.

If $$a!=1$$, $$b!+c!$$ is odd so $$b!=1$$ and $$c!=2^d-2$$, so $$c!\nmid4$$ and $$c\le3$$. This gives the solutions $$c=2$$ and $$c=3$$.

If $$a!=2$$, $$b!+c!$$ isn't a multiple of $$4$$, so $$b\le3$$. In particular, if $$a=b-2$$ then $$c!=2^d-4$$ is a multiple of $$4$$ but not $$8$$ so $$4\le c\le7$$, and similarly if $$a=2,\,b=3$$ then $$8\le c\le15$$. I'll leave you to check these cases.

Without loss of generality, we can assume $$a\leq b\leq c$$. Let's do some remarks. I will suppose $$d> 3$$, the first cases are easy to check by hands and they will coincides with the solutions in $$a=1$$.

If $$a,b,c\geq 3$$ then $$3$$ divides $$a!+b!+c!$$, but $$3$$ does not divide $$2^d$$. Hence $$a=1,2$$. (the case $$a=0$$ is equal to case $$a=1$$; in the solutions you can replace $$0$$ with $$1$$)

Case $$a=2$$

We have $$2! + b! + c! = 2^d$$ that is $$1+\frac{b!}{2}+\frac{c!}{2}=2^{d-1}$$.

If $$b,c\geq 4$$ then the LHS is odd and the RHS is even. Then $$b$$ has to be $$2$$ or $$3$$.

If $$b=2$$ we have $$c!=2^{d}-4 = 4(2^{d-2}-1)$$. So we need $$c\geq 4$$ in order to have a factor $$2^2$$ in the LHS. But now the LHS have a factor $$2^3$$ in its factorization, and the RHS don't, a contradiction.

If $$b=3$$ we have $$c!=2^d-8=8(2^{d-3}-1)$$. As above we need $$c\geq 4$$ in order to have a factor $$2^3$$ in the LHS, but if $$c\geq 6$$ we have a factor $$2^4$$ in the LHS factorization and the RHS don't. So $$c$$ can be only $$4$$ or $$5$$.

With these considerations, the solutions are: $$(a,b,c,d) = (2,3,4,5), (2,3,5,7)$$

Case $$a=1$$

We have $$1+b!+c! = 2^d$$ that is $$b!+c! = 2^d-1$$. The RHS is odd, so $$b!+c!$$ has to be odd. For, we need $$b!$$ odd and $$c!$$ even (because $$b\leq c$$). Hence, the unique case is $$b=1$$.

So now we have $$c! = 2^{d}-2 = 2(2^{d-1}-1)$$, and using the same argument used in the case above, we will find that $$c$$ can be only $$2$$ or $$3$$.

With these considerations the solutions are: $$(a,b,c,d) = (1,1,2,2), (1,1,3,3)$$

Edit: Thanks to Gareth Ma for his remark (case $$a=1$$).

• The variables are non-negative, so you need to consider $0$ cases. Also you missed $a=b=1$ case anyways. Apr 12 '20 at 8:25
• @GarethMa You are right! Thanks! Apr 12 '20 at 8:39

Just to give a slightly different approach, let's show that $$\max(a,b,c)\le5$$, which reduces the problem to a finite search.

Let's assume $$a\le b\le c$$. As others have noted, we must have $$a\le2$$, since $$a!\mid(a!+b!+c!)$$. Now if $$b\gt3$$, then $$4\not\mid(a!+b!)$$. It follows that $$16\not\mid(a!+b!)$$, since $$a\le b\le3$$ implies $$a!+b!\le12\lt16$$.

Now suppose $$c\ge6$$. Then $$c!=720n$$ for some $$n\ge1$$ and thus $$2^d=a!+b!+c!\gt720$$ implies $$d\ge10$$, in which case

$$a!+b!=2^d-720n=16(2^{d-4}+45n)\implies16\mid(a!+b!)$$

To complete the search, note that if $$c=5$$ or $$4$$, then we have $$2^d\gt4!=24$$, hence $$d\ge5$$, and thus $$8$$ divides $$2^d-c!=a!+b!$$, which occurs if and only if $$a!=2$$ and $$b!=6$$ (i.e., $$a=2$$ and $$b=3$$), while if $$c=3$$ or $$2$$ then $$a!+b!=2^d-c!$$ is divisible by $$2$$ but not by $$4$$, and this occurs if and only if $$a!=b!=1$$ (i.e, $$a,b\in\{0,1\}$$). Finally, we cannot have $$c=1$$ (or $$0$$) since that would give $$a!+b!+c!=1+1+1=3$$, which is not a power of $$2$$. Thus the factorial values $$(a!,b!,c!)$$ (with $$a\le b\le c$$) that sum to a power of $$2$$ are $$(1,1,6)$$, $$(2,6,24)$$, and $$(2,6,120)$$. All other solutions are permutations of these.