Let $ a_n$ be the last nonzero digit in the decimal representation of the number $ n!.$ Does the sequence $ a_1, a_2, \ldots, a_n, \ldots$ become periodic after a finite number of terms?
Problem
Source: IMO ShortList 1991, Problem 15 (USS 2)
Tags: factorial, modular arithmetic, Periodic sequence, IMO Shortlist, decimal representation, Digits
07.03.2009 05:13
No. First of all, note that if $ N$ is the period, then one can find an arbitrarily large $ k>0$ and $ M>0$ such that $ 10^k+M\cdot 10^{k+1}$ is divisible by $ N$. Indeed, if $ N=AB$ where $ A$ has only factors $ 2$ and $ 5$ in its prime decomposition and $ B$ is relatively prime with $ 10$, then, for all large $ k$, the number $ 10^k$ is divisible by $ A$ and $ 1+10M$ is divisible by $ B$ for an appropriate choice of $ M$. Thus, if the sequence has period $ N$, we should have the same last non-zero digit for $ (10^k-1)!$ and $ (2\cdot 10^k+M\cdot 10^{k+1}-1)!$. But when we are passing to the next factorials, in the first case this digit remains the same and in the second one it gets "multiplied by $ 2$" (it cannot be $ 5$ because the power of $ 2$ in large factorials far exceeds the power of $ 5$).
16.12.2009 01:19
Hi . This file is about Last nonzero digit of $ n!$ and $ n^n$.
Attachments:
two.pdf (114kb)
31.07.2011 20:33
Go by contradiction. If $n=5q+r$ with $0\le r\le4$, and $L(n)$ denotes the last nonzero digit of $n!$, then it's not hard to show that $L(5q+r)\equiv 2^q L(q)L(r)\pmod5$. Taking $q=4k+3$ and $r=4$, we have (since $2^4\equiv1\pmod5$ and $4!=24$) \[L(20k+19) \equiv 8L(4k+3)L(4) \equiv 2L(4k+3)\pmod5.\]But $(20k+19) - (4k+3) = 16(k+1)$, so we get a contradiction by taking $d|k+1$ for sufficiently large $k$, where $d$ is the period of the sequence for large $n$. Note that $L(n)$ is never divisible by $5$.
10.11.2018 09:39
fedja wrote: Thus, if the sequence has period $ N$, we should have the same last non-zero digit for $ (10^k-1)!$ and $ (2\cdot 10^k+M\cdot 10^{k+1}-1)!$. But when we are passing to the next factorials, in the first case this digit remains the same and in the second one it gets "multiplied by $ 2$" (it cannot be $ 5$ because the power of $ 2$ in large factorials far exceeds the power of $ 5$). I know I am bumping a really old post, but I was seeing this solution and had some confusion in the above part. When we are passing to the next factorials, in the second case the number is $[10^k(2+10M)]!$. But if $3|2+10M$, then the second one actually gets "multiplied by $6$", in which case the last digit remains the same. How does the given argument get over this case? Any help would be greatly appreciated.
14.11.2018 10:39
Please help out