last non-zero digit of factorial

We will show how to compute the last non-zero digit of the factorialMathworldPlanetmath of a number from its digits without having to compute the factorial itself.

Let L(n) denote the last non-zero digit of n in base 10. We note some basic properties of L which can easily be checked:

  • For all n, we have L(10n)=L(n).

  • If L(m)5 and L(n)5, then L(mn)=L(L(m)L(n)).

We also tabulate the values of L(n!) for small values of n:

L(0!) = 1
L(1!) = 1
L(2!) = 2
L(3!) = 6
L(4!) = 4
L(5!) = 2
L(6!) = 2
L(7!) = 4
L(8!) = 2
L(9!) = 8
L(10!) = 8

Next, we make two less trivial observations:


For all positive integers n, we have L(n!)5.

Title last non-zero digit of factorial
Canonical name LastNonzeroDigitOfFactorial
Date of creation 2013-03-24 0:23:36
Last modified on 2013-03-24 0:23:36
Owner rspuzio (6075)
Last modified by rspuzio (6075)
Numerical id 4
Author rspuzio (6075)
Entry type Definition