Somehow the last digit of 6x7x8 or 16x17x18 is the same as 3!, can someone prove this pattern for me?

47 Views Asked by At

When trying to find a solution for the problem "Find the last digit of factorial". I encounter this small problem inside a solution on the internet and I can't prove it.

Somehow 6x7x8 (336), 16x17x18 (4896),... have the same last digit as 3! (6). Also 6x7x8x9, 16x17x18x19,.... have the same last digit as 4!. Same with 6x7 and 2!. We will omit the case of 1! and 6 or 16 since the last digit of the product of 6 and any even number will always be the same as the last digit of that number (6x2 = 12, 6x4 = 24, 6x18 = 108) (please note that the number before in the solution I mention is always even, so let's skip this 1! and 6 cases)

I can easily prove for 4! and 11x12x13x14 or 3! and 21x22x23 has the same last digit, since we removed the number 5 and 0, the last digit of the result is always the product of the last digits of the components.

Now I only need to prove 2! 3! 4! have the same last digit as 6x7 6x7x8 6x7x8x9, then of course it will apply for any number behind.

The source of solution for anyone who needed. Actually, I want to understand why the last digit of n! is the same as 2^a x a! x b! while a is floor(n/5), b is n mod 5. I understand the 2^a x a! part, the n mod 5 (b!) part is the "small problem" I'm talking about and I need to prove the above to complete understanding.