What is sum of $\sum_{x=1}^n x \log (x)$ [closed]
Solution 1:
Let $a_n=n$, $b_n=\log n$ and $A_n=a_1+\ldots+a_n = \frac{n(n+1)}{2}$.
By summation by parts
$$\begin{eqnarray*} \sum_{n=1}^{N}n\log n &=& \frac{N(N+1)}{2}\log N-\sum_{n=1}^{N-1}\frac{n(n+1)}{2}\left[\log(n+1)-\log n\right] \\ &=&\frac{N^2}{2}\log N+\frac{N}{2}\log N-\sum_{n=1}^{N-1}\frac{n+1}{2}+\sum_{n=1}^{N-1}\frac{n(n+1)}{2}\left[\frac{1}{n}-\log\left(1+\frac{1}{n}\right)\right]\\&=&\frac{N^2}{2}\log N-\frac{N^2}{4}+\frac{N}{2}\log N+O(N).\end{eqnarray*}$$
Solution 2:
First solution:
Note: This approach can be made more rigorous by using
$$\sum_{n=1}^xa_n=\sum_{n=1}^\infty a_n-a_{n+x}$$
Whenever $a_n\to0$. Rewrite the summand using summation by parts and polynomial terms to get it in this form.
Now we can differentiate our sums.
Let us define
$$f(x)=\sum_{n=1}^xn\ln(n)$$
Then, we have
$$f(x)=x\ln(x)+f(x-1)$$
Differentiate both sides to get
$$f'(x)=\ln(x)+1+f'(x-1)$$
Solving this, we find that
$$\begin{align}f'(x)&=f'(0)+\sum_{n=1}^x\ln(n)+1\\&=f'(0)+\ln(x!)+x\\&=f'(0)+\ln(\Gamma(x+1))+x\end{align}$$
Integrate back, you'll find that
$$f(x)=f'(0)x+\psi^{(-2)}(x+1)+\psi^{(-2)}(1)+\frac12x^2\\=f'(0)x+\psi^{(-2)}(x+1)+\frac12\ln(2\pi)+\frac12x^2$$
where $\psi^{(n)}(x)$ is the extended polygamma function. Plug in $x=1$ and $f(1)=0$ to get
$$\begin{align}f'(0)&=-\psi^{(-2)}(2)-\frac12\\&=\frac12-\ln(2\pi)\end{align}$$
And thus, the closed form is given by
$$f(x)=\left(\frac12-\ln(2\pi)\right)x+\psi^{(-2)}(x+1)+\frac12\ln(2\pi)+\frac12x^2$$
Special values may be obtained by noting that:
$$I=\int_0^1\ln(\Gamma(t))~\mathrm dt=\int_0^1\ln(\Gamma(1-t))~\mathrm dt$$
Add them together and divide by two:
$$I=\frac12\ln(\pi)-\frac12\int_0^1\ln(\sin(\pi t))~\mathrm dt$$
And from there use the recursive formula:
$$\int_0^{n+1}\ln(\Gamma(t))~\mathrm dt=\int_0^1\ln(\Gamma(t))~\mathrm dt+\int_0^n\ln(t)+\ln(\Gamma(t))~\mathrm dt$$
This is related to the Barnes G-function since
$$\psi^{(-2)}(x)-\psi^{(-2)}(0)=\int_0^x\ln(\Gamma(t))~\mathrm dt=\frac{x(1-x)}2+\frac x2\ln(2\pi)+x\ln(\Gamma(x))-\ln(G(x+1))$$
Second solution:
Another approach to this problem would be to note that:
$$x\ln(x)=\frac d{ds}x^s\bigg|_{s=1}$$
This gives us:
$$\begin{align}\sum_{n=1}^xn\ln(n)&=\frac d{ds}\sum_{n=1}^xn^s\bigg|_{s=1}\\&=\frac d{ds}\big[\zeta(-s)-\zeta(-s,x+1)\big]\bigg|_{s=1}\\&=\zeta'(-1)-\zeta^{(1,0)}(-1,x+1)\end{align}$$
where $\zeta'(-1)=\frac1{12}-\ln(A)$ and, well, I suppose we'd work out $\zeta^{(1,0)}(-1,x+1)$ in the fashion of the first solution.
Solution 3:
$$\sum _{x=1}^n x \log (x)=\log (H(n))$$
From mathworld.wolfram.com where: $H(n)$ is the hyperfactorial