Factorials

Friends with Factorials - Cyclicity



Kamlesh Sir once remarked – long back! – “Rahul Sir, Don’t put exclamation mark after numbers at least – they become something else :) Such is maths – doesn’t allow you to use interjections of exclamation as well :)”


It has been a while now that I have written an article for the site! Life runs heck busy teaching lovely kids day in and out. So, now that I have the time tonight – let me get started with my cup of tea and………………


Let me run you through the exclamatory numbers! The Factorials!

What are factorials? 


Factorials represent a product of consecutive natural numbers. 


N! = 1*2*3*……….*(N-1)*N 


N! = (N-1)!*N


For example, 5! = 1*2*3*4*5 = 120.


Now, 5! Can also be written as: 5! = 4! * 5 = 24* 5 = 120.


Factorials begin with 0!, but with an interesting tinge to them:


1! = 1


1! = 0! * 1


1 = 0! * 1 


0! = 1 


Hence, this is how the list of factorials goes:


0! = 1, 1! = 1, 2! = 2, 3! = 6, 4! = 24, 5! = 120, 6! = 720, 7! = 5040 and so on. It is advisable to remember factorials up to 7! At least


Now, that you know factorials are: Let me take you to factorials which comes under Cyclicity. Remember, my motive here is not to teach you cyclicity in details – my objective is to make you FRIENDS with FACTORIALS. I will cover further aspects of factorials in my further articles. 


QUESTION 1: NUMBER SYSTEM – LAST DIGIT PROBLEM


N = (1!)^2 + (2!)^2 + (3!)^2 + (4!)^2 + …….. (23!)^2


Find the last digit of N.


B-School Solution:   N>4, Last digit of N! will always be ZERO. Hence, we add the last digits of the first four terms of the given series. [Since, adding last digits is enough to find out the last digit]. Hence, Last Digit of N = 1+4+6+6 = 7.


Solution Guide:  See, 1! = 1, Hence its square becomes 1. 2! = 2, its square = 4, 3! = 6, square 6 and 4! Is 24 – last digit is 4, square becomes 6 again. Now, add these four as explained above. Note, 5! = 120 which has last digit as 0, square will again be 0 and same applies to 6! And all the bigger factorials


Question 2: NUMBER SYSTEM – NUMBER OF ZEROS IN THE END


Find the number of zeros in the rightmost end of 37!


B-School Solution:   No. of zeros in the rightmost end is same as the power of 5 in the given factorial.


No. of 5s in 37! = [37/5] + [37/25] = 7+1 = 8. 


Solution Guide:  In a factorial, zero comes in the last when a 5 multiplies a 2. Now, in a product, every 2nd number is even and has 2 as a factor, but every 5th number is divisible by 5. Hence, we will have lesser number of 5s than 2s in a factorial >1!. This implies, the number of zeros will depend on the number of 5s in a factorial. For example, lets take the case of 8! 


8! = 1*2*3*4*5*6*7*8 = 1*2*3*(2*2)*5*(2*3)*7*(2*2*2)


Now, this implies we have 7 twos and 1 five! How many zeros will come when you multiply 2^7 and 5^1. Lets have a further look.


2^7 * 5^1 = (2*5) * 2^6 = 10* 64 = 640. Hence, it depends on the power of 5 – since 5 becomes the limiting factor.


Now, how to find the number of 5s in a factorial –


Every 5th number will have a power of 5. Hence, to find out the number of terms having 51, we need to divide the number by 5 and round it off to the largest integer less than the fractional value.


See, 37/5 = 7.4 == which after rounding off to the integer just less than this value = 7.


Now, every 5th number in these numbers will be divisible by 52 that is 25. Hence, now we find the number of numbers which have that extra 5 in them. 


See, 7/5 = 1.4 == rounding off = 1.


Now, we add these to get the total as 7 + 1 = 8.


Question 3: NUMBER SYSTEM – Last non zero digit of a factorial


Find the last non zero digit of 13!


B-School Solution:   Represent 13 as 13 = 5*2+3 that is in the form 5a+b. Now, Find out the last digit of – 


2^a * Last non zero digit of (a!) *  Last non zero digit of (b!)


In our question: a = 2, b = 3. 


Hence, 2^2 * 2 * 6 = 4 * 2 * 6 = 8.


The above method is a shortcut technique, but small valued factorial question might test you on things which this formula might not work on. Hence,


Alternative Solution: Let us understand how to factorize a factorial.


As discussed in a question above, the power of a prime factor “p” in N! is:


Power = [N/p] + [N/P2] + ……..


For example, Lets find power of 2 in 13! 


Power = [13/2] + [13/4] + [13/8] = 6 + 3 + 1 = 10


See, we stop once the denominator becomes > than the numerator.


Now, represent N! in the prime factor form. Prime factor form implies writing a number in the form where its prime factors are raised to powers and multiplied. For example:


24 = 2^3 * 3^1


40 = 2^3 * 5^1


Now, 13! Becomes –


13! = 2^10 * 3^5 * 5^2 * 7^1 * 11^1 * 13^1


Confused? Let us check again how we found out the power of 3 in 13!


[13/3] + [13/9] = 4 + 1 = 5. Now you know.


13! = 2^10 * 3^5 * 5^2 * 7^1 * 11^1 * 13^1


Now, what gives us zeros in the end? – multiplication with 10s. Right?


So, let us remove the 10s, which means remove the 5s with an equal number of 2s because one 5 and one 2 make one 10.


So, Now, we look at the above number as: - (removed 10s)


2^8 * 3^5 * 7^1 * 11^1 * 13^1


Now, you must know how to find out last digit of this remaining expression. Multiply the last digits, you get the LAST NON ZERO DIGIT.


LAST DIGITS: 2^8 – 6, 3^5 – 3, 7,1,3


Now, multiplying them – 6*3*7*1*3 = 8.


Hope you made some bonding with factorials by now! Will be back with more factorial from different topics.


Enjoy reading, Enjoy solving!


Cheers!