A problem from the book "Which Way Did the Bicycle Go" by Stan Wagon (I found my own solution to the problem):
Find the right most non-zero digit of 1,000,000!.
As a warm up, how many zeroes end 1,000,000!, and how many digits make up 1,000,000!.
Solution: Let r(n) = rightmost nonzero digit of n. Then r(m×n) = r(m)×r(n) if r(m) and r(n) are not equal to 5. Also, 1 and 6 act as identities (6 only for when r(n) is an even number). That is, r(6n) = r(n) if r(n) is even.
r(10!) = r(1·2·3·4·5·6·7·8·9·10) = 8 (evaluate manually)
r(100!) = r(1···10)r(11···20)r(21···100). But r(11) = r(1), and r(12) = r(2), r(13) = r(3), r(14) = r(4), however r(15) = r(5·3/1). Meaning that when we multiply by a number divisible by 5, r(m·n) is not necessarily equal to r(m)·r(n). The only numbers that are effected are r(20) which we must write as r(10×4/2), r(25) = r(5×5/1), r(30) = r(10×6/2), ..., r(95) = r(5×19/1), and r(100) = r(10×20/2). Therefore,
r(100!) = r[10![(1·2)/(1·2)]·10![(3·4)/(1·2)]·10![(5·6)/(1·2)]···10![(19·20)/(1·2)]]
= r(10!)10r(20!/(2!)10) = r(810)r(8·8·3·2/4) = r(44)r(6) = r(4)r(6) = 4.
Similarly, only numbers divisible by 25 behave differently for numbers 101-1000, when compared to the numbers 1-100. That is, r(115) behaves like r(15), but r(125) must be written as r(25×5/1), r(150) = r(50×6/2), r(175) = r(75×7/3), r(200) = r(100×8/4), ..., r(975) = r(75×39/3), r(1000) = r(100×40/4). So,
r(1,000!) = r(100!)10r(40!/(4!)10) = r(4)10r[(84/6)(8!/24)] = r(6)r(44·2) = 2.
r(10,000!) = r(1,000!)10r(80!/(8!)10) = r(210)r(80!/4) = r(80!) = r(88·16!/28) = r(48·16!) = 8.
r(100,000!) = r(10,000!)10r(160!/(16!)10) = r(810)r(160!/810) = r(160!) = r(816·32!/216) = r(32!) = r(83·6!/(23)·1·2) = r(4·2·2) = 6.
r(1,000,000!) = r(100,000!)10r(320!/(32!)10) = r(320!) = r(832·6!/23·1·2) = r(64!) = r(86·12!/26·4!) = r(12!·4) = r(8·2·4) = 4.
To find the nuber of zeroes that follow the above mentioned 4, we add 106/5 = 2655 = 200,000, plus 106/25 = 40,000 plus 106/125 = 8,000 plus 106/625 = 1600 plus 106/3125 = 320 plus 106/15625 = 64 plus int(106/57) = 12 plus int(106/58) = 2 which sums to 249,998.
To get the number of digits in 1,000,000!, we need int(the sum Log10(k) from k = 1 to k = 1,000,000) + 1, using maple or something. That total is int(5,565,708.91718627) + 1 = 5,565,709 digits in 1,000,000!.