Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

What is the first non zero digit in 50 factorial (50!)?

Any Help or hint will be appreciated.

share|improve this question
    
its a 2 (counting form right to left, or a 3 = –  Dominic Michaelis Mar 26 '13 at 9:35
    
@DominicMichaelis: how to write the equivalent symbol in latex? i have an answer and working for this. –  Manoj Pandey Mar 26 '13 at 9:38
    
@ManojPandey you mean $\equiv$ that is \equiv –  Dominic Michaelis Mar 26 '13 at 9:39
    
@DominicMichaelis thanks –  Manoj Pandey Mar 26 '13 at 9:41
3  
Since you accepted the answer that computes the last nonzero digit, I suppose you meant that; you might want to change the question to match. –  Marc van Leeuwen Mar 26 '13 at 9:53
add comment

3 Answers

up vote 5 down vote accepted

First, the exponent of $2$ in $50!$ is $47$, and the exponent of $5$ in $50!$ is $12$, so we’re looking for $\frac{50!}{10^{12}}$ mod$ 10$.


Since $\frac{50!}{10^{12}}$ is even (in fact, divisible by $2^{35}$), it suffices to compute it mod $5$:

$\frac{50!}{5^{12}}$ $\equiv$ ($4!$. $1$. $4!$. $2$. $4!$. $3$. $4!$. $4$. $4!$. $1$.($4!$. $1$. $4!$. $2$. $4!$. $3$. $4!$. $4$. $4!$). $2$

=$4!^{10}$.$4!^2$.2!

$\equiv$$(-1)^{10}$.$(-1)^2$.2

$\equiv$ $2$ mod $5$

$\frac{50}{10^{12}}$ $\equiv$ $2$.$2^{-12}$ $\equiv$ $2$ . $(2^4)^{-3}$ $\equiv$ $2$ mod $5$


So, $\frac{50!}{5^{12}}$ $\equiv$ $2$ (mod $10$ )

share|improve this answer
    
"Since $\frac{50!}{10^12}$ is even" should be replaced by "Since $\frac{50!}{10^{12}}$ is even"...Please edit. –  learner Apr 21 '13 at 16:37
add comment

Since $50_{\text{ten}}=200_{\text{five}}$, $\sigma_5(50)=2$. Thus, the number of factors of $5$ in $50!$ is $\frac{50-2}{5-1}=12$.

Since $50_{\text{ten}}=110010_{\text{two}}$, $\sigma_2(50)=3$. Thus, the number of factors of $2$ in $50!$ is $\frac{50-3}{2-1}=47$.

Thus, $\frac{50!}{10^{12}}$ has $35$ factors of $2$.

Little Fermat says that $2^4\equiv1\pmod{5}$, so $2\cdot2^4\equiv2\pmod{10}$, therefore $2^{35}\equiv2\cdot2^{34}\equiv2\cdot2^2\equiv8\pmod{10}$.


Every integer is uniquely representable as $m\cdot2^j\cdot5^k$ where $(m,10)=1$.

Let's compute the product $\bmod{\,10}$ of all of the numbers $m$ so that $(m,10)=1$ and $m\cdot2^j\cdot5^k\le50$, grouped by $2^j\cdot5^k$:

$\overbrace{(1\cdot3\cdot7\cdot9)^5}^{1}\overbrace{(1\cdot3\cdot7\cdot9)^2(1\cdot3)}^{2}\overbrace{(1\cdot3\cdot7\cdot9)^1(1)}^{4}\overbrace{(1\cdot3)^{\vphantom{1}}}^{8}\overbrace{(1\cdot3)^{\vphantom{1}}}^{16}\overbrace{(1)^{\vphantom{1}}}^{32}\\ \overbrace{(1\cdot3\cdot7\cdot9)^1}^{5}\overbrace{(1\cdot3)^{\vphantom{1}}}^{10}\overbrace{(1)^{\vphantom{1}}}^{20}\overbrace{(1)^{\vphantom{1}}}^{40}\\ \overbrace{(1)^{\vphantom{1}}}^{25}\overbrace{(1)^{\vphantom{1}}}^{50}\\ \equiv(1\cdot3\cdot7\cdot9)^9(1\cdot3)^4\equiv9\pmod{10}$


Thus, $\frac{50!}{10^{12}}\equiv8\cdot9\equiv2\pmod{10}$.

share|improve this answer
    
thorough and good explanation –  Manoj Pandey Mar 26 '13 at 13:33
    
Won't this give the last non-zero digit? –  BlueRaja - Danny Pflughoeft Mar 26 '13 at 16:21
    
@BlueRaja-DannyPflughoeft: That depends from which side you are counting. The boundary between the non-zero digits of $n!$ and the string of $0$s to the right is the lowest order or rightmost non-zero digit, I figured that is what the OP meant. The highest order or leftmost digit is easily computed using Stirling's formula to be $3$. See also Marc van Leeuwen's comment –  robjohn Mar 26 '13 at 16:32
add comment

The obvious method is to compute $50!$ and look at its digits (there's not that many of them). Here it is:

30414093201713378043612608166064768844377641568960512000000000000

This is fairly straightforward to do on a computer (as long as you're alert for numerical overflow). This method also has the benefits of (a) giving you all the other digits too, which helps you cross-check that the answer is correct, (b) being less likely to incur human error, and (c) will be more scaleable than human-operated methods.

In Wolfram|Alpha, we can input 50! to obtain:

Wolfram|Alpha computation of $50!$

I personally prefer to use GAP. In GAP, we input Factorial(50); to obtain:

gap> Factorial(50);
30414093201713378043612608166064768844377641568960512000000000000

Or if we're feeling industrious, we might whip up some code to compute the last non-zero digit of $n!$ for all $n \in \{1,2,\ldots,100\}$.

for n in [1..100] do
  N:=Factorial(n);
  str:=DigitsNumber(N,10);
  i:=Size(str);
  while(str[i]='0') do
    i:=i-1;
  od;
  Print(n," ",Int([str[i]]),"\n");
od;

We can put these numbers into Sloane's On-Line Encyclopedia of Integer Sequences, and discover it's sequence A008904. Here we can learn all sorts of things about these numbers, along with code for SAGE, Python, Mathematica and PARI (much more efficient than mine above).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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