# How do I find sum of digits of a given factorial with missing digits?

Suppose its given that

21!=5109094x17170y440000

How do I find

x+y

I know any factorial bigger than 6! will be divisible by 9. So I can apply that rule to find out it should be

52+x+y divisible by 9

. Which will imply that

x+y = 2

21! = 51090942171709440000

so

x+y = 11

Is there any rule that I am missing which will tell me the actual sum, not the digit sum?

You can use the divisibility test for $$11$$. Add the digits in even places and subtract the digits in odd places. The result must be a multiple of $$11$$. That will distinguish your two cases.
One way to proceed is to note the excess factors of $$2$$ over factors of $$5$$. You may want to check out Legendre's Formula, which is relevant to what follows.
Write down the numbers from $$1$$ to $$21$$. You see four of them with factors of $$5$$, each without a second factor of $$5$$. So the factorial has four factors of $$5$$. But for factors of $$2$$ first there are ten of those from $$2$$ up to $$20$$, then five of those ten are multiples of $$4$$ and thus have an additional factor of $$2$$, and you tack on still more factors of $$2$$ for the multiples of $$8$$ and finally $$16$$. You add all those up and there are $$18$$ factors of $$2$$.
This difference between factors of $$2$$ and $$5$$ implies that there are only four terminal zeroes but the preceding digits must be a multiple of $$2^{14}$$. This means, for instance, the last six digits before the terminal zeroes must be a multiple of $$64$$. Why do I choose six digits in this example? As we will see, going three digits before the final $$y$$ will lead to a unique solution.
Divide $$170y44$$ by $$64$$ by first putting in $$y=0$$, getting a remainder $$R$$, then interpreting the remainder as $$100y+R$$ for any $$y$$. Knowing $$R$$, you are to match $$y$$ with $$R$$ so that the combined remainder $$100y+R$$ is a multiple of $$64$$. Here $$R=60$$, and only $$y=9$$ among single positive digits matches with a multiple of $$64$$. Having found $$x+y=11$$ with the divisibility tests for $$9$$ and $$11$$ (Ross Milliken), you then conclude $$x=2$$.