2
$\begingroup$

Any large factorial will have a number of zero behind it, and one could write an expression to compute the number of trailing zeros, but how would one go about computing the non-zero end digits?

E.g. compute first 5 non-zero end digits of (10^12)!

$\endgroup$
0
$\begingroup$

I solved this just now--a crucial fact is that there are more factors of 2 than of 5.

To formalize notation, let $v(N) $ be the largest positive integer such that $\large 10^{v(N))} | N$, and let $M(N) := \dfrac{N}{10^{v(N)}}$ denote the number of which we are trying to find the last 5 digits if $N = (10^{12})!$.

Hint: What can you say about $M(N) \mod 2^5$? How about $M(N) \mod 5^5$? How about $$ \Large M \left ( \prod_{\substack{ 1 \leq n \leq 10^{12} \\ 5 \not \, \,| \, n } } n \right ) \mod 5^5?$$ How about $$ \Large M \left ( \prod_{\substack{ 1 \leq n \leq 10^{12} \\ 25 \not \, \,| \, n } } n \right ) \mod 5^5?$$ Can you see a pattern?

$\endgroup$
  • $\begingroup$ hey, you got it? That's great! $\endgroup$ – Scaramouche Jan 18 '12 at 3:27
0
$\begingroup$

Hint: if you wanted just the last digit, a naive approach would be to do all the multiplication mod 10, skipping the 0's. $ (1*2*3*4*5*6*7*8*9)^{10^{11}}$. A second thought is that the $5$ swallows the $2$, so we can skip those. This works fine for all the factors besides $2$ and $5$, which need some more thought...

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.