Showing posts with label PUZZLES. Show all posts
Showing posts with label PUZZLES. Show all posts
04:05

How to find the first Non-zero digit of a factorial?

I mean, how to find Rightmost non-zero digit of n! or R(n!).

let n be the given number.
    R(n!) be the function that will give us right most non-zero digit of n!.


write the given n in the following form:

              n=5*q+r.             

where, q-> quotient
           r-> remainder

              R(n!) = Last Digit of [ 2 qx R(q!) x R(r!) ]           


Some of the factorials we are familiar with are:
0! = 1; 1! = 1; 2! = 2; 3! = 6; 4! = 24; 5! = 120; 6! = 720; 7! = 5040.
let's take an example:
what is first non-zero digit in 18!?

n=18,
it is re-written as 18=5*3+3.

R(18!)=Last Digit of [23xR(3!)xR(3!)]
              =Last Digit of [8x6x6]
              =8.
actual value of 18!=
6402373705728000.

let's take even bigger one.
what is first non-zero digit in 551!?
n=551.
551=5*110+1;
q=110, r=1

R(551!)=Last Digit of [2110xR(110!)xR(1!)]
          
It's a recursive procedure.
110=5x22+0
 R(110!)=Last Digit of [222xR(22!)xR(0!)]

again, 22=5x4+2

R(22!)=Last Digit of [24xR(4!)xR(2!)]
              =Last Digit of [16 x 24 x 2]

              =8.
R(110!)=Last Digit of [222xR(22!)xR(0!)]            
=Last Digit of [222x 8 x 1]
=Last Digit of[4 x 8 x 1]            
=2.

R(551!)=Last Digit of [2
110xR(110!)xR(1!)]
               =Last Digit of [4 x 2 x 1]
               =8.

finally R(551!)=8.    (Is it not smart way of doing it?.)

just remember this,


              R(n!) = Last Digit of [ 2 qx R(q!) x R(r!) ]           
                   



02:38

How many number of zeros in factorial of a given number?

let n be the given number.
Z be the no of zero's in n!.

n!=n*(n-1)*(n-2)...*1.


if n=18
18!=18*17*16*15*14*13*12*11*10*.................*1.

simply, z=no of 5's in the n!

18*=18*17*16*(5*3)*14*13*12*11*(5*2)*........*5*........*1.

no/- of 5's in 18! are 3.

actually, 18!=6402373705728000. (so, 
it's correct.)


Direct formula :

Z=(n/5)+(n/5^2)+(n/5^3)+......+(n/5^(k-1)).


where (n/5^k)=0.                                       


here, what i am doing is just adding exponents of 5 in n! expansion.
just remember this:

zero's in n!= highest power of 5 in n! expansion.

22:37

Find a 10-digit number where the first digit is how many zeros in the number?, the second digit is how many 1s in the number etc. until the tenth digit which is how many 9s in the number.

here is my approach:

let n be the no of zeros.(we don't know exact position of those 'n' zeros yet)


1.write 'n' in 0th place. 

digits :  n  ?  ?   ?   ?  ?  ?   ?  ?   ?  
places: 0  1  2  3  4  5  6  7  8  9 

2. now, we got new digit 'n'. write 1 in nth place.


digits:  n  ?  ?   ?   ?  1  ?   ?  ?   ?  
places: 0  .   .   .    .  n   .   .   .    9

3.we got digit 1 here, but we cant write 1 in 1's place.
   but, we can write 1 in 2's place and 2 in 1's place.


digits : n  2  1   ?   ?  1  ?   ?  ?   ?
places: 0  1  2   .    .  n   .   .   .   9 


4.solve for n?

(no of occupied places+n)=10

places filled: {0,1,2,n}

n+4=10

so, n=6.

5.just, write 0's in remaining positions.

finally, solution is

digits : 6  2  1   0   0  0   1   0   0   0  
places: 0  1  2   3   4  5   6   7   8   9 

 Note: it may have more than one solution.


07:52
prime number puzzle:

Consider the prime set (11,13) (17,19) (29,31).....and so on.

which have one number between them.

prove that the number is divisible by 6.




 Proof:
          

For any given 3 consecutive numbers one of them is 

divisible by 3. 

each given prime set have an even number in between.

By definition primes are only divisible 1 and itself.

so, the missed number is divisible by 3. since it is also even it 

is divisible by 2.



The number divisible by 3 and 2 is also divisible by 6.