Understanding a very elementary property of factorials 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.
 A: We find
$$\sum_{m\ge1}\psi\left(\frac{x}{m}\right)=\sum_{m\ge1}\sum_{k\ge1}\vartheta\left(\sqrt[k]{\frac{x}{m}}\right)=\sum_{m\ge1}\sum_{k\ge1}\sum_{p\le \sqrt[k]{x/m}}\log p$$
$$=\sum_{m\ge1}\sum_{k\ge1}\sum_{mp^k\le x}\log p=\log \prod_{p\le x}p^{\#\{(m,k):mp^k\le x\}}=\log x!$$
since when counting $\#\{(m,k):mp^k\le x\}$, one sees for every $1\le n\le x$ there are $t=v_p(n)$ different tuples $(m,t),(mp,t-1),\cdots,(mp^{t-1},1)$ counted in the set (note $k\ge1$).
A: 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.
