TITLE: Understanding a very elementary property of factorials
QUESTION [6 upvotes]: I've seen this stated in a few places.  

If $$\vartheta(x) = \sum_{p\le{x}} \log (p) \qquad \psi(x) = \sum_{m=1}^{\infty}\vartheta\left(\sqrt[m]{x}\right)$$ Then $$\log(x!) = \sum_{m=1}^{\infty} \psi\left(\frac{x}{m}\right).$$

It is used by Ramanujan here. It is used by Jitsuro Nagura here.
Can anyone provide a proof for why it is true or provide a link to a proof?
Thanks very much.

REPLY [2 votes]: A slightly different variation based upon the prime factorisation of $x!$.

We obtain for integers $x>0$
\begin{align*}
\color{blue}{\log x!}&=\log\prod_{p\leq x}p^{\left\lfloor\frac{x}{p}\right\rfloor+\left\lfloor\frac{x}{p^2}\right\rfloor+\cdots}\tag{1}\\
&=\log\prod_{p\leq x}p^{\sum_{m=1}^\infty\left\lfloor\frac{x}{p^m}\right\rfloor}\tag{2}\\
&=\sum_{p\leq x}\sum_{m=1}^\infty\log p\left\lfloor\frac{x}{p^m}\right\rfloor\tag{3}\\
&=\sum_{m=1}^\infty\sum_{p\leq \sqrt[m]{x}}\log p\left\lfloor\frac{x}{p^m}\right\rfloor\tag{4}\\
&=\sum_{m=1}^\infty\sum_{p\leq \sqrt[m]{x}}\log p\sum_{j=1}^{x/p^m}1\tag{5}\\
&=\sum_{m=1}^\infty\sum_{j=1}^x\sum_{p\leq \sqrt[m]{x}}\log p\tag{6}\\
&\,\,\color{blue}{=\sum_{j=1}^x\psi\left(\frac{x}{j}\right)}
\end{align*}
  and the claim follows.

Comment:

In (1) we do the prime factorisation of $x!$ and observe that $\left\lfloor\frac{x}{p}\right\rfloor$ counts the numbers $\leq x$ which are a multiple of $p$. Since we also have to add $1$ for each number which is a multiple of $p^2$ we add $\left\lfloor\frac{x}{p^2}\right\rfloor$, etc.
In (2)  we use  the series notation. Note the series is finite.
In (3) we use  properties of the logarithm.
In (4) we exchange the order of the series.
In (5) we write the factor $\left\lfloor\frac{x}{p^m}\right\rfloor$ as sum.
In (6) we  exchange the order of the series again.