What is the antiderivative of $x^{x^{x^{x...}}}$?

What is $\int{x^{x^{x^{x^{\dots }}}}dx}$? I managed to get it down to a complicated series after using $u$-substitution, but I want to see other methods of approach, or if my answer was right.

First I let $$u=x^{x^{x^{x^{\dots }}}}$$, and $du$ would be, in terms of $u$, $$du= \frac{u}{\frac{1-ln(u)}{u}e^{ln(u)/u}}$$ This makes the integral of $$\int{x^{x^{x^{x^{\dots }}}}dx}=\int \frac{1 - ln(u)}{u}{e^{ln(u)/u} }du$$ Now making $w = ln(u), dw$ becomes $1/u$ and the integral becomes $$\int e^{w/e^{w}}(1-w)dw$$ From there, I distributed and made $2$ integrals of series, using the Taylor polynomial for $e^x$. From there, I integrated and back substituted. I was only trying to find the indefinite integral.

I'm still a junior in high school, so let me know if the answer is beyond my scope of understanding.


The function satisfies $$y=e^{\ln(x)\cdot y}$$ which gives $$y=-\frac{W(-\ln(x))}{\ln(x)}$$

For the integral, $$I(x)=\int ydx=\int \frac{W(-\ln(x))}{-\ln(x)}dx$$

Let $u=-\ln x$, $dx=-e^{-u}du$, then the integral equals $$\int \frac{W(u)}{ue^u}du$$

Since $W(u)=\sum_{n=1}^{\infty}a_nu^n$ with $a_n=\frac{(-n)^{n-1}}{n!}$, $$I(x)=\sum^{\infty}_{n=0}a_n\int u^{n-1}e^{-u}du= \sum^{\infty}_{n=0}a_n\gamma(n,u)= \sum^{\infty}_{n=0}a_n\gamma(n,-\ln(x)) $$

where $\gamma(n,x)$ is the lower incomplete gamma function.

$$\int x^{x^{...}} dx= \sum^{\infty}_{n=0}\frac{(-n)^{n-1}}{n!}\gamma(n,-\ln(x))$$


Although Szeto's answer: $$\int x^{x^{...}} dx= \sum^{\infty}_{n=0}\frac{(-n)^{n-1}}{n!}\gamma(n,-\ln(x))$$ is correct. It does not converge for the complete domain of $x^{x^{x...}}$ which is $e^{-e}\le x \le e^{1/e}$ and instead only converges for $e^{-1/e}\le x\le e^{1/e}$. This is because the sum $W(u)=\sum_{n=1}^{\infty}\frac{(-n)^{n-1}}{n!}u^n$ has a radius of convergence of $|u|\lt \frac{1}{e}$. Below I will represent the integral as an infinite sum that converges for all $e^{-e}\le x \le e^{1/e}$.

$$ \int x^{x^{x^{.^{.......}}}} dx= \int\frac {-W(-\ln(x))}{\ln(x)} dx$$ let $ -\ln x=t $

$$ x=e^{-t} $$

$$dx =-xdt $$

$$ \therefore \int\frac {-W(-\ln(x))}{\ln(x)} dx =- \int \frac {W(t)}{te^t}dt $$ We know that: $$\frac{1}{e^t}=\sum_{n=0}^{\infty}\frac{(-t)^n}{n!}$$

$$- \int \frac {W(t)}{te^t}dt=- \int \sum_{n=0}^{\infty}\frac {(-1)^nW(t)(t)^n}{tn!}dt=- \int \sum_{n=0}^{\infty} \frac{(-1)^nW(t)(t)^{n-1}}{n!}dt $$

$$- \int \sum_{n=0}^{\infty} \frac{(-1)^nW(t)(t)^{n-1}}{n!}dt = - \sum_{n=0}^{\infty} \frac{(-1)^n}{n!}\int W(t)(t)^{n-1}dt $$ Now, $$\int W(t)(t)^{n-1}dt= \sum_{n=0}^{\infty}\frac {(t)^ne^{[-nW(t)]}[-nW(t)]^{-n}[n\Gamma(n+1, -nW(t))- \Gamma(n+2, -nW(t))]} {n^2} $$

The proof for this is long and can be confirmed by Wolfram Alpha.

Substituting $t=- \ln x$:

$\sum_{n=0}^{\infty}-\frac {(-1)^n(-\ln x)^ne^{[-nW(-\ln x)]}[-nW(-\ln x)]^{-n}[n\Gamma(n+1, -nW(-\ln x))- \Gamma(n+2, -nW(-\ln x))]} {(n!)n^2} $

And finally we have:

$ \int x^{x^{x^{.^{.......}}}} dx = \sum_{n=0}^{\infty}-\frac {(-1)^n(-\ln x)^ne^{[-nW(-\ln x)]}[-nW(-\ln x)]^{-n}[n\Gamma(n+1, -nW(-\ln x))- \Gamma(n+2, -nW(-\ln x))]} {(n!)n^2} $