Find the sum of all positive integers m such that 2 m can be expressed as sums of four factorials (of positive integers).
Details and assumptions
The number n ! , read as n factorial , is equal to the product of all positive integers less than or equal to n . For example, 7 ! = 7 × 6 × 5 × 4 × 3 × 2 × 1 .
The factorials do not have to be distinct. For example, 2 4 = 1 6 counts, because it equals 3 ! + 3 ! + 2 ! + 2 ! .
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Let's say that 2 k = a ! + b ! + c ! + d ! where a ≥ b ≥ c ≥ d . Note that k ≥ 2 since otherwise at least one of a , b , c , d has to be zero. Since d is the smallest number, all factorials of numbers greater than it divide d ! . For d ≥ 3 , 3 ∣ d ! , and by extension 3 divides the right side of the equation, but not the left one(since 2 k only contains 2 s). Hence, we have two cases: d = 1 and d = 2 .
Case 1 : d = 1 , we now have 2 k − 1 = a ! + b ! + c ! . Since all factorials of numbers greater than one are even, and 2 k − 1 is odd, we have that c = 1 , since c is now the smallest of the three numbers. The equation now becomes 2 k − 2 = a ! + b ! . If b > 3 we have that 4 ∣ a ! + b ! , but 4 ∣ 2 k − 2 . Hence, b ∈ { 1 , 2 , 3 } .
For b = 1 we have 2 k − 3 = a ! . For a > 2 , 3 ∣ a ! but 3 ∣ 2 k − 3 , so a ∈ { 1 , 2 } . For a = 1 we have that k = 2 and for a = 2 we have no solutions.
For b = 2 we have 2 k − 4 = a ! . If a < 4 , 2 ∣ a ! but 4 ∣ a ! (hence impossible since 4 ∣ 2 k − 4 and if a ≥ 4 we have that 8 ∣ a ! but 8 ∣ 2 k − 4 . Hence, this case produces no solutions.
For b = 3 we have 2 k − 8 = a ! . Using the logic from the previous part we can bound a as follows: 4 ≤ a ≤ 5 . By checking, we see that both cases give solutions: k = 5 and k = 7 respectively.
Case 2: d = 2 . The equation transforms to 2 k − 2 = a ! + b ! + c ! . Following a logic similar to the one for the previous case, we see that c ∈ { 2 , 3 } . Note: c = 1 since c ≥ d .
For c = 2 we have 2 k − 4 = a ! + b ! . Similarly to the previous case we get that b ∈ { 2 , 3 } .
For b = 2 , considering divisibility by 3 we get that the only solution is a = 2 ⟹ k = 3 .
For b = 3 , the left side is divisible by 2 only, while the right one is divisible by 4 for a ≥ 4 . a = 2 is not a solution, while a = 3 gives us k = 4 .
The only case left to consider now is c = 3 . The equation now is 2 k − 8 = a ! + b ! . Checking divisibility by 8 we see that 3 ≤ b ≤ 5 .
For b = 3 we have 2 k − 1 4 = a ! , which checking divisibility by 4 doesn't give solutions.
For b = 4 we have 2 k − 3 2 = a ! . If a ≤ 6 , 3 2 ∣ 2 k − 3 2 while 3 2 ∣ a ! . If a > 6 , 6 4 ∣ a ! while 6 4 ∣ 2 k − 3 2 . Hence, no solutions.
For b = 5 we have 2 k − 1 2 8 = a ! . Using a similar logic to the previous one, we bound a as follows: 8 ≤ a ≤ 9 . However, by checking manually, we see that neither case gives us solutions.
Hence, all solutions we found are k = 2 , 3 , 4 , 5 , 7 and the sum is 2 2 + 2 3 + 2 4 + 2 5 + 2 7 = 4 + 8 + 1 6 + 3 2 + 1 2 8 = 1 8 8 .
0!=`1 , so for a=b=c=d = 0 , m will be 2 . so 2^1 is impossible.
The rigour in this solution is what makes it marvelous! Truly great solution!
If 2^n is expressible as a sum of four factorials, then, since all factorials except for 1! and 2! are divisible by 3, we would necessarily have 1's and/or 2's in the sum; and since all factorials except for 1! are even, we would have to have either four 1's, two 1's or none; so finally 2^n would have to be expressible in one of the following forms: 1+1+1+1 1+1+2+2 1 +1 + 2 + a! 1 +1 + a! +b! 2+2+2+2 2 + 2 + 2+ a! 2 + 2 +a! +b! 2 + a! +b! +c!
AS 3 <= a <= b <= c.
The first case yields 4, which is a power of 2. The second case yields 6, which is not.
In the third case, a!+4 must be a power of 2; this is not true for a=3, nor is it the case for any higher value for a, since in that case a! is divisible by 8 and therefore a!+4 must be divisible by 4 and by no higher power of 2.
In the fourth case, a must be =3, since otherwise both a! and b! are divisible by 8 and 2+a!+b! is congruent to 2 modulo 8. So b!=2^n-8 is divisible by 8 and by no higher power of 2, this means that b is at most 5, since 6!=720=16*45. And indeed, if b is 4 or 5, 1+1+3!+b! is 32 or 128.
The fifth case yields 8, a power of 2.
In the sixth case we want a!+6 to be a power of 2 , which is impossible, since it is divisible by 3 for a>=3.
In the seventh case we want a!+b!+4 to be a power of 2. If a and b are both >=4, a!+b!+4 is congruent to 4 mod 8; so a must be =3 and we want b!+10 to be a power of 2. That is the case for b=3, but not for b=4, nor for b>=5, since in that case b!+10 is divisible by 5.
In the eighth case, a must be =3, since otherwise a!+b!+c!+2 is congruent to 2 modulo 8. So we want b!+c!+8 to be a power of 2. b=c=3 doesn't work, so b! and c! must both be divisible by 8, i.e. b and c are both >=4. But they can't both be >=6, since in that case b! and c! are both divisible by 16 and b!+c!+8 is only divisible by 8. So b is either 4 or 5, and we want 32+c! or 128+c! to be a power of 2. Since 8!, hence also c! for any c>=8, is divisible by 128, c!+32 is congruent to 32 mod 128 and cannot be a power of 2. Likewise, as 10! is divisible by 256, c!+128 is congruent to 128 mod 256 and cannot be a power of 2 for c>9. So we only have to check a few potential cases, which yield no further solutions.
Thus, the only powers of 2 that can be written as a sum of four factorials are 4, 8, 16, 32, and 128 4+8+16+32+128=188.
at least 1 of the 4 factorials must be smaller than 3, if not the number itself will be a multiple of 3. so we try 1!+1!+1!+1!=4,2!+2!+2!+2!=8,3!+3!+2!+2!=16,4!+3!+1!+1!=32, and 5!+3!+1!+1!=128, since 64, 256 and 512(because 4x5!<520) doesn't work, and the other powers will make the answer exceed 1000, we stop at 128 and the answer is 4+8+16+32+120=188.
First, notice that at least one of the factorials must be 1 or 2 , otherwise the sum is divisible by 3 .
Some of the small powers of 2 can be represented as sums of factorials as follows:
4 = 1 ! + 1 ! + 1 ! + 1 ! , 8 = 2 ! + 2 ! + 2 ! + 2 ! , 1 6 = 2 ! + 2 ! + 3 ! + 3 ! , 3 2 = 1 ! + 1 ! + 3 ! + 4 !
The following table shows the order of prime 2 in n ! .
n o r d 2 n ! 1 0 2 1 3 1 4 3 5 3 6 4 7 4 8 7 9 7 1 0 8 From now on, we suppose that the power of 2 is at least 2 6 . Denote the number of times that n ! appears in the sum by a n . We already know that a 1 + a 2 ≥ 1 . Because 2 n is even, a 1 must be even. If it is 4 , then we get 4 = 1 + 1 + 1 + 1 . If it is 2 , we get 2 m = 1 + 1 + k ! + l ! for some k and l . Considering this sum modulo 4 , we conclude that a 2 + a 3 is odd, so either a 2 = 1 , a 3 = 0 or a 2 = 0 , a 3 = 1 .
In the first case, we get 2 m = 4 + k ! . Since we assumed that m ≥ 6 , the order of 2 in k ! must be 2 , which is impossible. In the second case, we get 2 m = 8 + k ! . Here the order of 2 in k ! must be 3 , so k equals 4 or 5 . In the first case the sum is 3 2 = 2 5 , that we already considered, and in the second case we get 1 2 8 = 1 ! + 1 ! + 3 ! + 5 ! , so 1 2 8 = 2 7 has to be counted.
We are left with the case a 1 = 0 . Considering the sum modulo 4 , we get that a 2 + a 3 is even. Because a 2 ≥ 1 , and a 2 + a 3 ≤ 4 , we get the following cases:
Case 1. a 2 = 4 , a 3 = 0 . Then the sum is 8 = 2 3 .
Case 2. a 2 = 3 , a 3 = 1 . Then the sum is 1 2 , which is not a power of 2 .
Case 3. a 2 = 2 , a 3 = 2 . Then the sum is 1 6 = 2 4 .
Case 4. a 2 = 2 , a 3 = 0 . Then 2 m = 4 + k ! + l ! , where k and l are at least 4 . This is impossible, because the right hand side is 4 modulo 8 .
Case 5. a 2 = 1 , a 3 = 3 . Then the sum is 2 0 , which is not a power of 2 .
Case 6. a 2 = 1 , a 3 = 1 . Then 2 m = 8 + k ! + l ! . Because the left hand side is divisible by 1 6 , we conclude that a 4 + a 5 is odd. If a 4 = 1 , a 5 = 0 , we get 2 m = 3 2 + l ! , with l ≥ 6 . Because m ≥ 6 , the order of 2 in l ! must be 5 , which is impossible. If a 4 = 0 , a 5 = 1 , then 2 m = 1 2 8 + l ! with l ≥ 6 . If l ≥ 1 0 , then the right hand side is 1 2 8 modulo 2 8 , so 2 m ≤ 1 2 8 , which is impossible. So the only cases possible are l = 7 , 8 , 9 . By inspection, they do not produce powers of 2 .
Putting it all together, we get 2 + 3 + 4 + 5 + 7 = 2 1 .
1! = 1 2! = 2 3! = 6 4! = 24 5! = 120 6! = 720 7! = 5040 8! = 41320
Smallest sum of 4 factorial = 4 x 1! = 4
2^0 = 1 (2 < 4) 2^1 = 2 (2 < 4) 2^2 = 4 (1! + 1! + 1! + 1! = 4) 2^3 = 8 (2! + 2! + 2! + 2! = 8) 2^4 = 16 (2! + 2! + 3! + 3! = 16) 2^5 = 32 (4! + 3! + 1! + 1! = 32) 2^6 = 64 (no possible combination) 2^7 = 128 (5! + 3! + 1! + 1! = 128) 2^8 = 256 (no possible combination) 2^9 = 512 (no possible combination) 2^10 = 1024 (no possible combination) 2^11 = 2048 (no possible combination)
Assume that there are no more sums of 4 factorials that can be expressed as powers of 2.
4 + 8 + 16 + 32 + 128 = 188
Final ans: 188
Clearly the power of 2 will not exceed 9 as answer limit is 0-999. Hence checking for these nine numbers is very easy. This will result into final solution as 4 + 8 + 16 + 32 + 128 = 188. Another concept which I can be a tentative solution is the factoradic notation . For more details refer, here
I listed all the factorials from 1 to 7, any number higher than that will have intervals that are too great to be able to add up to any power of two. I then calculated all the powers of two and tested if I could add up to them using four factorials. Again, you don't need to go any higher than a certain number of powers because the intervals become too great again.
2 cannot be expressed as a sum of 4 factorials,2^2 = 1!+1!+1!+1!,2^3=2!+2!+2!+2!,2^4 = 3!+3!+2!+2!,2^5 = 4!+3!+1!+1!,2^7 = 5! + 3! +1!+1! and other values cannot be expressed as the sum of the last digits of the powers of 2 matches only the values of 2!,1!,3!,4!,5!
Begin by writing all powers of 2 from 2 to 1 0 2 4 ). Also, write all factorials from 1 to 1 2 0 .
Powers of 2 : { 2 , 4 , 8 , 1 6 , 3 2 , 6 4 , 1 2 8 , 2 5 6 , 5 1 2 } . Factorials: { 1 , 2 , 6 , 2 4 , 1 2 0 , 7 2 0 } .
Now, individually test each power of 2 . 2 cannot be represented like this. The following powers of 2 can be written as the sum of these four factorials: 4 − { 1 , 1 , 1 , 1 } , 8 − { 2 , 2 , 2 , 2 } , 1 6 − { 6 , 6 , 2 , 2 } , and 1 2 8 − { 1 2 0 , 6 , 1 , 1 } .
6 4 cannot be expressed as the sums because the highest factorial less than 6 4 is 2 4 . 6 4 would have to be comprised of as many 2 4 s as possible, { 2 4 , 2 4 } . With a high leftover amount of 1 6 , 1 6 cannot be written as the sum of two factorials. Thus, 6 4 cannot.
The same logic is used for 2 5 6 and 5 1 2 . 2 5 6 would be { 1 2 0 , 1 2 0 } with a remainder of 1 6 . 5 1 2 would be { 1 2 0 , 1 2 0 , 1 2 0 , 1 2 0 } , which doesn't even come to 5 1 2 . Thus, only the above numbers work.
It can easily be shown that no numbers past 1 2 8 can be written as a sum of four factorials, but for time's sake, we only have to test up to 5 1 2 because the maximum input for brilliant.org is 999.
4 + 8 + 1 6 + 3 2 + 1 2 8 = 1 8 8 .
several powers of 2 come which when added give188
Problem Loading...
Note Loading...
Set Loading...
We need to find all k such that 2 k = a ! + b ! + c ! + d ! WLOG, let a ≥ b ≥ c ≥ d . Note that d ! ∣ a ! , d ! ∣ b ! , d ! ∣ c ! , hence d ! ∣ 2 k . We can see that d=1 or 2: if d ≥ 3 , then since d ! ∣ 2 k , 2 k must contain a factor of 3, clearly impossible.
If d = 1 , then c must also be 1, as all 2 k are even for positive k. If b ≥ 4 , then 4 ∣ b ! , a ! , so a ! + b ! + c ! + d ! ≡ 2 ( m o d 4 ) , clearly impossible for k > 1 . We can use casework:
If b=1, then a must be 1 as well. Thus, 2 k = 4 .
If b=2, then 2 k = a ! + 4 , so a<4. Quick testing yields no solutions.
If b=3, then 2 k = a ! + 8 , so a<6. Quick testing yields 2 k = 1 2 8 , 3 2 .
Now, we try d = 2 . Clearly, c can only be 2 or 3.
If c = 2 , then we need 2 k = a ! + b ! + 4 . Since b < 4 (by divisibility), b can only be 2 or 3. Similarly, a can only be 2 or 3 as well. We can quickly check that (a,b,c,d)=(3,3,2,2) or (2,2,2,2) work, so 2 k = 1 6 , 8 .
If c = 3 , we need 2 k = a ! + b ! + 8 . In this case, b can only be 4 or 5. Therefore, we get 2 k = a ! + 3 2 (impossible for a ! to have exactly 5 factors of 2) or 2 k = a ! + 1 2 8 . In the latter case, a can be 8 or 9. Neither works.
Our final answer is 1 2 8 + 3 2 + 1 6 + 8 + 4 = 1 8 8 .