# Extending Sophomore's Dream

I've been trying to extend the famous Sophomore's Dream identity by allowing the upper limit in the integral to be any natural number $k$: $$\int_0^k x^{-x} dx =\ ?$$

Following the analytical proof of the standard Sophomore's Dream, I wrote $x^{-x} = \exp(-x\log(x))$ and expanded the Taylor series of $\exp$. After interchanging the order of summation and integration one gets

$$J_k \doteq \int_0^k x^{-x} dx = \int_0^k \sum_{n=0}^\infty \frac{(-x)^n (\log x)^n}{n!}dx = \sum_{n=0}^\infty \frac{(-1)^n}{n!} \int_0^k x^n (\log x)^ndx$$

The integral is similar to the usual one, but the different upper limit calls for a different substitution $x = k\exp\left(-\frac{u}{n+1}\right)$ in order to let $u$ vary within $[0,+\infty)$. Call the integral $I_{n,k}$: $$\begin{split} I_{n,k} &\doteq \int_0^k x^n (\log x)^ndx = \int_0^\infty k^n e^{-\frac{nu}{n+1}} \left(\log(ke^{-\frac{u}{n+1}})\right)^n \frac{ke^{-\frac{u}{n+1}}}{n+1}du \\ &= \frac{k^{n+1}}{n+1} \int_0^\infty e^{-u} \left(\log k - \frac{u}{n+1}\right)^n du \end{split}$$ Applying the binomial theorem we obtain $$\begin{split} I_{n,k} &= \frac{k^{n+1}}{n+1} \int_0^\infty e^{-u} \sum_{j=0}^n \binom{n}{j}(-1)^{n-j}(\log k)^{j}\frac{u^{n-j}}{(n+1)^{n-j}} du \\ &= \frac{k^{n+1}}{n+1} \sum_{j=0}^n \binom{n}{j}(-1)^{n-j}\frac{(\log k)^{j}}{(n+1)^{n-j}} \int_0^\infty e^{-u} u^{n-j} du \\ &= \frac{k^{n+1}}{n+1} \sum_{j=0}^n \binom{n}{j}(-1)^{n-j}\frac{(\log k)^{j}}{(n+1)^{n-j}} (n-j)! \\ &= \frac{k^{n+1}}{n+1} \sum_{j=0}^n \frac{n!}{j!}\frac{(-1)^{n-j}}{(n+1)^{n-j}}(\log k)^{j} \end{split}$$ Plugging in the formula for $J_k$: $$\begin{split} J_k &= \sum_{n=0}^\infty \frac{k^{n+1}}{n+1} \sum_{j=0}^n \frac{(-1)^{j}}{(n+1)^{n-j}}\frac{(\log k)^{j}}{j!} \\ &= \sum_{n=1}^\infty \frac{k^{n}}{n^{n}} \sum_{j=0}^{n-1} n^{j}(-1)^{j}\frac{(\log k)^{j}}{j!} \end{split}$$

Here, I am stuck. The innermost sum looks like a dampened exponential in $\log k$, but it is multiplied by an extraneous factor of $n^{j}$. Is there a way to simplify the identity even more?