1 × 2 × 3 × ⋯ × 2 0 1 8 My computer solves for the above product and finds its digit sum (sum of all its digits). It then repeats this process of calculating the digit sum until only one digit remains.
What digit is that?
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.
This relies on the fact that a whole number's sum of digits is divisible by 9 if and only if the number is divisible by 9.
Here's a short proof for the 3-digit case, which can easily be extended to any number of digits.
We can write a number with a hundreds, b tens and c ones as
1 0 0 a + 1 0 b + 1 c .
Move out an a and b term together with the c
9 9 a + 9 b + 1 a + 1 b + 1 c
which we can write as using three terms:
9 9 a + 9 b + ( a + b + c ) .
9 divides 99 and 9, so the only restriction to the number being divisible by 9 is a + b + c ; that is, the sum of the digits. That term being divisible by 9 means the whole number is divisible by 9 (and vice versa).
Why is it definitely divisible by 9? Is it a rule of factorials that the original number's, in this case 2018, factorial is divisible by the same numbers?
Log in to reply
Yes, because you are multiplying by 9, it has to be divisible by 9. A separate fact is that the sum of the digits of any number divisible by 9 is divisible by 9. By reapplication of the second fact, you can get the solution.
Log in to reply
Okay I see. Thank you for the explanation :)
It is definitely divisible by 9 because 2018 is divisible by 9 (2018/9 = 224), so a factorial will also be (you're just multiplying 2018 by 2017!, so dividing it by 9 will equals 224 * 2017!, which is an integer). Then she just applied the rule to know when a number is divisible by 9, which is that the sum of its digits must also be divisible by 9, so at the end the result can only be 9.
Log in to reply
Any factorial from 9! above is divisible by 9, since it is product containing 9 as one of the factors.
Log in to reply
@Marta Reece – True, even more elegant :) Thanks
@Marta Reece – It goes even lower. Since the prime factorization of 6 is 2 × 3 and 3 < 6, any factorial from starting from 6! is divisible by 9.
Log in to reply
@Akeel Howell – True that. I just did the simplest thing available.
2018 is not divisible by 9... 2018/9 is 224.2222... But the fact remains that its factorial is, as explained by Marta Reece
i dont get why the last digit has to be 9 like 99 is divisible by 9 and its sum is 18, but it doesnt end with a 9
Log in to reply
But you are not to one digit. To get there, you need to add up 1+8=9. And you do get a 9.
Log in to reply
Oh you need to get to one digit. I should read questions better. I thought they meant the last digit of the product.
The number that was divisible by 9 in the original post wasn't the "last digit" of the number, but the "last remaining digit" after repeating the process of adding up the digits.
How is a hundreds if it's 99?
This is so cool because it means that for every factorial of a number bigger than 8, the last digit sum is always 9!
Log in to reply
It's actually true for factorials of all integers greater than 5.
1 2 3 4 5 6 7 |
|
1 2 3 |
|
In python3 you can use a generator expression instead of a list comprehension, so you can drop the
[]
in the digitsum formula. Also, there is a built-in factorial in the
math
library.
cheating, just joking. hehe.
import math
n = math.factorial(factorial)
(but you can also use the solution above, with "Divisiblity Rules" so you dont need a computer...)
I realize thx. It was a one time loop so I figured I'd calculate myself.
How do you put python code in your solution?
I read the solution-writing/formatting guides but no mention of it there.
Thanks in advance, from a newbie.
Log in to reply
Here you go https://brilliant.org/math-formatting-guide/
my favourite solution!
Multiples of 9 has digit sums divisible by 9 as well. 2018! contains multiple of 9 as 9 itself is contained in the factorial. i.e. 1x2x....9x...2018
But so is 6, 7, and 8, so why is the answer 9?
Log in to reply
Well... Its a special property that holds for a number divisible by 9. It can contain any other factors. But as long the those factors contain 9 (or 3 x 3), the digit sum is divisible by 9. You can repeat this until there is only 1 digit and the property still holds. It wont hold true for other factors. i.e. the ones you have mentioned 6,7,8. I'll briefly try to explain.
Let a number be represented as ABCDE (you can extend this to any number of digits as you like). Now this can be written as; E + 10D + 100C + 1000B + 10000A
or
E + D + 9D + C + 99C + B + 999B + A + 9999A = E + D + C + B + A + 9D + 99C + 999B + 9999A
So if you say ABCDE is divisible by 9, then it means (E + D + C + B + A + 9D + 99C + 999B + 9999A ) is divisible by 9 too.
For E + D + C + B + A + 9D + 99C + 999B + 9999A to be divisible by 9 it's clear that sum of E + D + C + B + A must be divisible by 9 as well. i.e. the digit sum. (rest of the terms as automatically divided by 9 regardless of the digit value)
Log in to reply
I wanted to ask the same question, somehow you explained it in a more understandable way than "Challange Master Note" Thank You ^^
And, any ! that is 6 or higher will have digit sums of 9 since it contains x3 and x6 which is 3x2. So they all are multiples of 9. 6! has a digit sum of 9 as does 7! and 8!, Etc.
2018! is divisible by 9 as 2018! = 1x2x3x...9x10x11....2018 and the divisibility rule of 9 says that the sum of the digits till the digit remains a single one must be 9. Therefore the answer is 9
Extra: Every factorial of a number above 5 has the same property
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
In this solution, we begin with 2 0 1 8 ! as our input integer and repeatedly sum the digits using Python's powerful string capabilities.
The heavy lifting is done here:
1 2 |
|
Here, we recursively call our function,
digSum(num)
, with the result of its most recent input. Starting with
2
0
1
8
!
, we
sum()
all of the integers,
i
, in the number,
num
. To accomplish this, we convert our number into a string with
str(num)
, allowing us to iterate over the number one digit at a time with a
for
statement, making summing the digits easy! So essentially, this line is saying:
For all of the characters in the number string, turn them into integers and sum them all together.
This is done multiple times until we check and find that there is a single digit remaining, bringing us to our answer, 9 .
Any multiple of 9 has a digital root of 9. 2018! is a multiple of 9, so its digital root must be 9.
In the given set, every integer from 1 to 2018 is given. (This can also be expressed as 2018! )Given that every number is being multiplied together and one of those numbers is 9, we can conclude that the final number will be 9. How? Divisibility rules tell us that the digits of any multiple of 9 will add up to be a multiple of 9. From that logic, we can conclude that when this process is repeated, the end result will be 9.
Good explanation! Divisibility rules is very helpful here.
Bonus: What if the computer computes the number in a different base q , would the solving technique be any different?
If x ∈ N , then the digital root d ( x ) of x is the single-digit number obtained by iteratively summing up the digits of x and its subsequent iterations. Moreover, d ( x ) ≡ x m o d 9 . To see this, write the decimal expansion of x and note that the n t h term in the expansion is congruent to the n t h digit of x modulo 9. Since 2 0 1 8 ! is divisible by 9, so is the single-digit number d ( x ) . Therefore, d ( x ) = 9
The number 2018! is congruent to 0 (mod 9) since 9 appears in there at least once. Let n = 2018!. The canonical representation of n in base ten is n = n 0 1 0 0 + n 1 1 0 1 . . . + n r 1 0 r . Notice that since 1 0 ≡ 1 ( m o d 9 ) , n ≡ n 1 + n 2 + ⋯ + n r ( m o d 9 ) . This means that the sum of the digits of a number is congruent to the number itself mod 9. So when we get the number m from doing this process repeatedly we should note that m ≡ n ( m o d 9 ) and since m is one digit and n is 0 (mod 9) [or 9 (mod 9)] we can be sure of our answer m =9
A simple python code with recursion does the trick:
1 2 3 4 5 6 7 |
|
And of course that the output is:
1 |
|
The 'digit sum' of any number that's divisible by 9 is 9.
2018! is divisible by 9. So repeatedly obtaining the digit sum gives 9
Similarly, The 'digit sum' of any number that's divisible by 3 is 3.
So, does there exists another single digit integer N (besides 3 and 9) such that the 'digit sum' of any number that's divisible by N is N?
In 2018! ,it is divisible by 9 then the sum so.So, out of 4 option 9 is divisible by 9.So it is correct
Here is how I did it: 2018! Is divisible by 9
I just used my calculator untill E(error) appeared. I typed in 1×2× ... ×21 then 5.10909422E+19 appeared and the last number was 9!
Good attempt. It's good to realize that the digital sum of 6 ! , 7 ! , 8 ! , … are seemingly all 9. The next step is to prove that they are all indeed 9.
It seems that the result is always 9 from 6 !
Yes, do you know why the result is always 9 for n ! , where n = 6 , 7 , 8 , 9 , … ?
Problem Loading...
Note Loading...
Set Loading...
Relevant wiki: Divisibility Rules (2,3,5,7,11,13,17,19,...)
The number, 2 0 1 8 ! , is definitely divisible by 9 . The sum of its digits is as well, etc. So the last remaining digit too has to be divisible by 9 , which can only happen if it is 9