Answer the question
In order to leave comments, you need to log in
What is the sum of the digits in the factorial of 337?
Please help me calculate the sum of the digits of the factorial "337!". That is, if 6!=720, then the sum of its digits will be 7+2+0=9. What will be the sum of the digits "337!" ? Obviously, it will not work, the number is very large, there is a hint, a sign of divisibility by 3 or 9.
Answer the question
In order to leave comments, you need to log in
factorial = lambda n: (n == 0 and 1) or factorial(n - 1) * n
sum(int(i) for i in str(factorial(337))) # => 2817
In the development of the method using maxima, proposed by Armenian Radio :
s: 0$ for n: 337! next (n-r)/10 while n >= 1 do (r: mod(n,10), s: s+r)$ s;
Take a calculator and fold 130932804149088992546057261943598916651380085320056882046632369209980447 \
366486195583875107499552077757320239493552004852577547570260331861859535521014 \
367028762150336371971084184802220775697724840028097301334011793388942370614718 \
341215113319703287766478296719019864501440605926667194653195515282444560161328 \
301222855804492620971650056743347973226019758046208866500052558105710981673345 \
457144935004205153930768986245233790635907756296677802809190469443074096751804 \
464370890609618413796499897335752206338990966921419488285779097481797799327000 \
523783874784902588031943372895509486862780297994201058534583425203348291866696 \
42514432000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)
Students who master maxima
can
confuse the teacher. The factorial is calculated in less than a second.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question