Tuesday, August 2, 2011

Last Non Zero Digit Of a factorial

This is an oft repeated concept in different examinations but if you can grasp the following algorithm solving problems is a one min task

Concept

Lets say D(N) denotes the last non zero digit of factorial, then the algo says
D(N)=4*D[N/5]*D(Unit digit of N)[If tens digit of N is odd]
D(N)=6*D[N/5]*D(Unit digit of N)[If tens digit of N is even]; Where [N/5] is greatest Integer Function

#Problem 18
Find the last non zero digit of 26!*33!.

Solution Scheme and Approach
D(26)=6*D[26/5]*D(6)=6*D(5)*D(6)=6*2*2=4[D(5) means last non zero digit of 5!=120 which is 2, same for D(6)]
D(33)=4*D[33/5]*D(3)=4*D(6)*D(3)=4*2*6=8

Hence last non aero digit of 26!*33!=4*8=2
Remember
D(1)=1 D(2)=2 D(3)=6 D(4)=4 D(5)=2 D(6)=2 D(7)=4 D(8)=2 D(9)=8

Now solve:
(1)Last Non Zero Digit of 99!*26!.
(2)How many zeros are at the end of 13!+14!+15!+16!+17!+18!

5 comments:

  1. (1)6 would be the last non zero digit.
    (2)There would be 2 zeros at the end.
    Can anybody confirm whether my answers are ryt or not?

    ReplyDelete
  2. 10! is 3628800-- hence last non zero digit is 8 right... good, now we will apply ur algorithm

    D(10)=6*D(10/5)*D(0)=6*D(2)8*0!=6*2*1=12=2
    Please let me know if I did something wrong.

    ReplyDelete