# Is the sequence $(\log(n!)\mod1)_{n\in\mathbb N}$ dense in the interval $[0,1]$?

This question was raised in the comment by Todd Trimble at how to proof there is a natural number n, the first four digits of n! Is 2018?. I thought the question may be posted separately, as even partial answers to it may turn out useful and instructive for a number of users (certainly including me).

A trivial remark is that, in view of Stirling's formula, this question can be restated as follows: Is the sequence $((n+1/2)\log n-n\log e\mod1)_{n\in\mathbb N}$ dense in the interval $[0,1]$? It would be surprising to me if the answer here is no or if it depends on the base of the logarithm.

• This should be failry easy to handle by Weyl differencing... – Will Sawin Mar 27 '18 at 22:10
• Indeed: fix $k > 0$, find $n$ large enough with $\operatorname{frac}(\log n) \approx \frac{1}{k}$ and observe that $\log(n!), \log((n+1)!), \ldots, \log((n+k-1)!)$ modulo $1$ are roughly uniformly distributed on $[0,1]$. However, is this sequence equidistributed? – Mateusz Kwaśnicki Mar 27 '18 at 22:32
• For an elementary proof, see John Edward Maxfield's 1970 paper A note on $N!$ in Mathematics Magazine, which I discussed last week in my answer to Short papers for undergraduate course on reading scholarly math. – Dave L Renfro Mar 29 '18 at 18:56
• @DaveLRenfro : It appears that the method in that note is similar to the one briefly described in the comment by Mateusz. – Iosif Pinelis Mar 30 '18 at 2:13

Let $a$ be the base of logarithm here. Consider the function $$f(x)=\frac{(x+1/2)\ln x-x}{\ln a}.$$

As noted in the question, it is enough to prove that the sequence $f(n)$ is dense modulo $1$. In fact, this sequence is equidistributed. By Weyl's criterion, it is enough to show that for any nonzero integer $k$ we have

$$\sum_{n \leq N} e^{2\pi ikf(n)}=o(N).$$

To prove this, let us use the van der Corput lemma, which states that if $g \in C^2(I)$, where $I$ is an interval and

$$\lambda\ll |g''(x)| \ll \lambda$$

for all $x \in I$ (constants in Vinogradov symbols are absolute) then

$$\sum_{n \in I\cap \mathbb Z} e^{2\pi ig(n)} \ll |I|\lambda^{1/2}+\lambda^{-1/2}.$$

Taking $g(x)=kf(x)$ and $I=[M,M_1]$ with $M<M_1 \leq 2M$ we get for $M$ large enough

$$\sum_{M\leq n\leq M_1} e^{2\pi i kf(n)} \ll \sqrt{kM},$$

as $f''(x)=\frac{1}{x\ln a}-\frac{1}{2x^2\ln a} \asymp \frac{1}{M}$ for $x \in I$.

Therefore, using the dyadic subdivision of the interval $[1,N]$ we get

$$\sum_{n \leq N} e^{2\pi i kf(n)} \ll \sqrt{kN}+1=o(N),$$

as needed.

• Bounds here are of course not uniform in $a$, but this has no effect on anything. Also, this can be fixed by adding something like $\sqrt{\ln a}$ to the rhs if $a \in \mathbb N$. – Asymptotiac K Mar 27 '18 at 22:39
• The third equation seems to miss some exponents. – Johannes Trost Mar 28 '18 at 7:11
• @JohannesTrost, what do you mean? I don't see any exponents missing.. – Asymptotiac K Mar 28 '18 at 8:10
• $|g''(x)|$ being much larger and much smaller than $\lambda$ at the same time does not make sense to me. Or did I miss something ? – Johannes Trost Mar 28 '18 at 10:45
• @JohannesTrost, $f\ll g$ means $f=O(g)$, this is Vinoradov's notation – Asymptotiac K Mar 28 '18 at 11:19