Computing Non-zero End Digits of Large Factorials

Stella: 2 days ago

Any large factorial will have a number of zero behind it, and one could write an expression to compute the number of trailing zeros, but how would one go about computing the non-zero end digits?

E.g. compute first 5 non-zero end digits of (10^12)!

Jacob: 2 days ago

This will be the least complete answer I've ever posted, but perhaps somebody else will be able to add to it. Not a complete answer (because I don't find any paper online), but I've heard Jean-Marc Deshouillers speak on his (with others, but I don't recall with whom) proof that the last non-zero base-$p$ digit of $n!$ forms a $q$-automatic sequence. I don't recall the hypothesis on $p$, nor the connection between $p$ and $q$.

But this answers (to a very limited extent) the real math-research level question hidden in this homework question. Or at least it would, if I could recall any details!