I solved this using a different approach -
Since, we all know how to calculate the powers of primes for a given Factorial (repeated divisions and then summing them together get the power)
So if we do this step wise, the question becomes intuitive.
1. 25! can be written in powers of it's prime factors.
2 . We know that prime factor can't be bigger the number itself so we are absolutely sure that we are not going to have a factor of prime number greater than 25, thus, last prime number we will have would be 23
3. So we find out the powers of primes :
25! = (2^22)*(3^10)*(5^6)*(7^3)*(11^2)*(13)*(17)*(19)*(23)
4. As anybody's first intuition about the problem would have highlighted that this number will be having a lot of trailing zeroes, we got that from power of 5s, which is 10^6. So we remove that from this number. Now remember ! Whenever we remove anything to find out the unit's place from a number by taking it away from the number - we give it back to the unit's place once we find it!
so the number we have in hand looks like this (after taking out 10^6 which is 2^6 and 5^6)-
(2^16)*(3^10)*(7^3)*(11^2)*(13)*(17)*(19)*(23)
5. Next step is to find out the unit's place for this big multiplication, which should be fairly easy to tell using the 4K repetition rule of powers.
6. The above number becomes -
6*9*3*1*3*7*9*3 => 4 at unit's place (only see what's remaining at unit's place after a single multiplication rather than calculating everything. Eg: 6*9 would give 54 so we only keep 4 to multiply with 3 which gives 12 we keep 2 and then so on...)
7. Finally, give back what you took (10^6) to the unit's place and you have the answer
Ans :
4*(10^6)