# How to calculate an approximation of $\int_0^\infty \left(x^x\operatorname{ mod }e^x\right)\frac{dx}{x^x}?$

This morning I was playing with the congruence implemented as Mod[m, n] in Wolfram Language, see the table from this MathWorld. I did these experiments with Wolfram Alpha online calculator:

Plot Mod[x^x, e^x]/x^x, for 0<x<20

and also with codes like this

integrate Mod[x^x, e^x]/x^x dx, from x=0 to 3

Question. Is it possible to deduce an approximation of $$\int_0^\infty \left(x^x\operatorname{ mod }e^x\right)\frac{dx}{x^x}?$$ Many thanks.

• What are you looking for by approximation? A numerical approximation can be achieved using the same methods to approximate any other integral. – Will Fisher Jul 2 '17 at 16:36
• I wanted ask the question only as curiosity, when I was playing with previous function in the integrand. Thus I don't need a very good approximation, just a curiosity. On the other hand I think that your work is very good, I am going to study it, and I hope that the users upvote your answer. Many thanks @WillFisher – user243301 Jul 2 '17 at 19:16

## 1 Answer

$I\approx 3.0547$. Alright well here's one decent way to get an approximation. We have that $$(x^x\text{ mod } e^x)x^{-x}=\frac{\text{frac}((x/e)^x)}{(x/e)^x}$$ So we have that $$I=\int_0^{\infty}(x^x\text{ mod } e^x)x^{-x}dx= \int_0^{\infty}\frac{\text{frac}((x/e)^x)}{(x/e)^x}dx=e+\int_e^{\infty}\frac{\text{frac}((x/e)^x)}{(x/e)^x}dx$$ Now let $u=(x/e)^x$. We then have that $du=(x/e)^x\ln(x)dx=u\ln(x)dx$. Thus $$I=e+\int_1^{\infty}\frac{\text{frac}(u)}{u^2\ln(x)}du$$ Moreover we have that $\ln(x)=W(\ln(u)/e)+1\approx\ln(\ln(u))$, to a fairly accurate degree when $u > 3$. Thus $$I\approx e+\int_1^{n}\frac{\text{frac}(u)}{u^2(W(\ln(u)/e)+1)}du+\int_n^{\infty}\frac{\text{frac}(u)}{u^2\ln(\ln(u))}du$$ However $$\int_n^{\infty}\frac{\text{frac}(u)}{u^2\ln(\ln(u))}du\approx \int_n^{\infty}\frac{\text{frac}(u)}{u^2}du=1-\gamma - \int_1^{n}\frac{\text{frac}(u)}{u^2}du$$ (numerically a difference of about $0.002$). So $$I\approx e+1-\gamma +\int_1^{n}\frac{\text{frac}(u)}{u^2}\cdot\left(\frac{1}{W(\ln(u)/e)+1}-1\right)du$$ Letting $n=100$ we get $I\approx 3.0547$. Of course you may just want to do standard approximations on $$I=e+\int_1^{\infty}\frac{\text{frac}(u)}{u^2(W(\ln(u)/e)+1)}du$$ since now to integrand doesn't require computing values of extreme magnitudes like $x^x$.

• This is much more than decent ! Numerical integration leads to $3.05121$. Thanks for providing this answer. – Claude Leibovici Jul 5 '17 at 7:53