Is it possible to find a closed-form expression for this integral?

$$\int_{0}^{\infty} \frac{1}{(x-\log x)^2}dx$$

Generalization of the Integral:

$$\int_{0}^{\infty} \frac{1}{(x-\log x)^{p}}dx$$

where, $\log x$ is a natural logarithm, $p\in\mathbb{Z^{+}}_{≥2}$

The indefinite integral can not be expressed by elementary mathematical functions according to Wolfram Alpha.

I can add a visual plot.

enter image description here

So, I dont know, is it possible to find a closed-form or not. But, I have a numerical solution:

$$\int_{0}^{\infty} \frac{1}{(x-\log x)^2}dx≈2.51792$$

  • 3
    $\begingroup$ Very much doubt a closed form solution exists $\endgroup$ – user679268 Jun 29 '19 at 10:26
  • 3
    $\begingroup$ This could become Learner's constant ! Back to serious, I checked with inverse symbolic calculators : no result. Cheers :-) $\endgroup$ – Claude Leibovici Jun 29 '19 at 12:42
  • 1
    $\begingroup$ @Learner. These are really nice words and I thank you. For me, mathemetics mean fun and beauty and I like to share with other people. $\endgroup$ – Claude Leibovici Jun 29 '19 at 13:15
  • 1
    $\begingroup$ @JamesArathoon You ask as motivation. But I was just curious about the problem myself. I found this integral graphically very exotic. Thank you very much also for your answer. $\endgroup$ – Learner Jul 25 '19 at 11:57
  • 1
    $\begingroup$ @ClaudeLeibovici Maybe it's not possible to do more than you do. Thank you very much for your work. Cheers. :) $\endgroup$ – Learner Jul 26 '19 at 8:15

Surprise !

Considering $$I=\int_{0}^{\infty} \frac{dx}{(x-\log x)^2}$$ and exploring simple linear combinations of a few basic constants, I found (be sure it took time !) $$\color{blue}{I\sim\frac{189}{4}(C+2\pi)+61 \pi \log (3)-\frac{1}{4} \left(57+101 \pi ^2+523 \pi \log (2)\right)}$$ which differs in absolute value by $10^{-18}$.


Funny is $$J=\int_{1}^{\infty} \frac{dx}{(x-\log x)^2}\sim \frac{717 \pi ^2-489 \pi-296 }{405 \pi ^2-420 \pi+112}$$which differs in absolute value by $3 \times 10^{-19}$. $$K=\int_{0}^{1} \frac{dx}{(x-\log x)^2}\sim \frac{157 e^2+693 e-1394}{489 e^2-62e-859}$$which differs in absolute value by $ 10^{-20}$.

So, another formula $$\color{blue}{I=J+K \sim \frac{157 e^2+693 e-1394}{489 e^2-62e-859}+\frac{717 \pi ^2-489 \pi-296 }{405 \pi ^2-420 \pi+112}}$$ which differs in absolute value by $3 \times 10^{-19}$.

  • $\begingroup$ Does it definitely differ? $\endgroup$ – marty cohen Jul 20 '19 at 17:21
  • 1
    $\begingroup$ @martycohen: Yes unfortunately - I find a result in agreement with Claude; numerically the difference is approximately $1.329\times10^{-18}$ $\endgroup$ – James Arathoon Jul 20 '19 at 19:23
  • $\begingroup$ @JamesArathoon. Just out of curiosity (since I am not a Mathemetica user while you obviusly are) : could you provide me the Mathemetica syntax for finding it ? I can use Mathemetica when going at university. For that, I have bee using a piece of junk we coded thirty years ago in my group. It took hours for me ! Thanks. $\endgroup$ – Claude Leibovici Jul 21 '19 at 2:22
  • $\begingroup$ Sorry errors when I cut and pasted expression, repeat version: I have no idea how you obtained the expression, but I took it and compared it with the integral in Mathematica thus N[(189/4) (Catalan+2*Pi)+61*Pi* Log[3]-(1/4) (57+101(Pi)^2+523*Pi Log[2]),25]-NIntegrate[1/(z-Log[z])^2,{z,0,Infinity},WorkingPrecision->25] $\endgroup$ – James Arathoon Jul 21 '19 at 14:48
  • 1
    $\begingroup$ @Learner. I thank you very much for that but I mainly thank you for the problem itself. When I see the number and the quality of so many answers to your question, it makes me (feeling) younger. There are really very good things here. MAy I confess that I am still working the problem ? Cheers :-) $\endgroup$ – Claude Leibovici Jul 25 '19 at 8:02

This is not an answer.

Interesting is $$\int_1^{\infty} \frac{dx}{(x-\log x)^2}=\sum _{n=1}^{\infty }\frac {n!} {n^n}$$ which does converge very fast.

Consider the partial sums $$S_p=\sum _{n=1}^{p }\frac {n!} {n^n}$$ For $50$ significant figures, some numbers $$\left( \begin{array}{cc} p & S_p \\ 10 & \color{red} {1.879}6270159950810984897034709192993117315185196423 \\ 20 & \color{red} {1.8798538}481559257260270045400130469482147900930324 \\ 30 & \color{red} {1.87985386217}44894409103304424245491837451422243904 \\ 40 & \color{red} {1.879853862175258}4934447274819840727420511215490319 \\ 50 & \color{red} {1.87985386217525853348}42821765377141403748180799027 \\ 60 & \color{red} {1.879853862175258533486306}0446953416699479277057812 \\ 70 & \color{red} {1.879853862175258533486306145}0660477978008661226702 \\ 80 & \color{red} {1.8798538621752585334863061450709}598007686986116986 \\ 90 & \color{red} {1.8798538621752585334863061450709600388}084239015953 \\ 100 & \color{red} {1.87985386217525853348630614507096003881987}28530863 \\ \cdots & \cdots \\ \infty &\color{red} {1.8798538621752585334863061450709600388198734004893} \end{array} \right)$$


After comments, it seems that I found another one which is amazing $$\int_{1}^{\infty} \frac{dx}{(x-\log x)^3}=\frac 12\left(\sum _{n=1}^{\infty }\frac {n!} {n^{n-1}}-1\right)$$


After @JJacquelin's answer, considering (for $p> 1 \:,\: p \text{ integer.}$) $$I_p=\int_1^\infty \frac{dx}{(x-\ln(x))^p}=\frac{1}{(p-1)!}\sum_{n=p-1}^\infty \frac{n!}{n^{n-p+2}}$$ write $$\sum_{n=p-1}^\infty \frac{n!}{n^{n-p+2}}=\sum_{n=p-1}^k \frac{n!}{n^{n-p+2}}+\sum_{n=k+1}^\infty \frac{n!}{n^{n-p+2}}$$ and, for the second sum, use the simplest form of Stirling approximation to get $$\sum_{n=k+1}^\infty \frac{n!}{n^{n-p+2}} \sim \sqrt{2 \pi }\, e^{-(k+1)}\, \Phi \left(\frac{1}{e},\frac{3-2p}{2},k+1\right)$$ where appears the Hurwitz-Lerch transcendent function.

This provide quite good estimates of the result. Below are given the values for a few $p$'s using $k=p+10$. $$\left( \begin{array}{ccc} p & \text{approximation} & \text{"exact"} \\ 2 & 1.879853659 & 1.879853862 \\ 3 & 1.201509078 & 1.201509604 \\ 4 & 0.935374084 & 0.935375123 \\ 5 & 0.786369570 & 0.786371320 \\ 6 & 0.688798359 & 0.688800999 \\ 7 & 0.618921197 & 0.618924881 \\ 8 & 0.565877612 & 0.565882462 \\ 9 & 0.523929461 & 0.523935568 \\ 10 & 0.489732430 & 0.489739855 \end{array} \right)$$

  • $\begingroup$ What a beautiful result when integrated over the interval $[1,\infty)$. $\endgroup$ – omegadot Jun 29 '19 at 13:30
  • 2
    $\begingroup$ @Learner. Be sure I tried but ... failed ! $\endgroup$ – Claude Leibovici Jun 29 '19 at 13:57
  • 1
    $\begingroup$ Teacher, can we generalize this integral $I_n(x)=\int_{0}^{\infty} \frac{1}{(x-\log x)^n}dx$, where $n≥2$ $\endgroup$ – Learner Jun 30 '19 at 11:10
  • 1
    $\begingroup$ @Learner. I am not a teacher. Have a look at my edit : I found Learner's constant of the second kind. Cheers. $\endgroup$ – Claude Leibovici Jun 30 '19 at 11:31
  • 1
    $\begingroup$ @Learner. I was just kiding, be sure ! But I am not (otherwise it would have been a pleasure to have you as a student). Thnaks for the problem. Cheers :-) $\endgroup$ – Claude Leibovici Jun 30 '19 at 11:48

A more general relationship :

$$\int_1^\infty \frac{dx}{(x-\ln(x))^p}=\sum_{k=0}^\infty \frac{(p+k-1)!}{(p-1)!\:(k+p-1)^{k+1}}\qquad p> 1 \:,\: p \text{ integer.}$$

This could be extended to real $p>1$ thanks to the function $\Gamma$.

Or, on an equivalent form : $$\int_1^\infty \frac{dx}{(x-\ln(x))^p}=\frac{1}{(p-1)!}\sum_{n=p-1}^\infty \frac{n!}{n^{n-p+2}}\qquad p> 1 \:,\: p \text{ integer.}$$

From this it is easy to find the already known cases $p=2$ and $p=3$.

Then other cases, for example : $$\int_1^\infty \frac{dx}{(x-\ln(x))^4}=\frac{1}{6}\sum_{n=3}^\infty \frac{n!}{n^{n-2}}$$

I let you the pleasure to prove the above formulas.

This is not too difficult in expending $\frac{1}{(1-t)^p}$ to series of powers of $t$ with $t=\frac{\ln(x)}{x}$ and knowing that $\int_1^\infty\frac{(\ln(x))^k}{x^{p+k}}dx=\frac{k!}{(k+p-1)^{k+1}}$.

  • 2
    $\begingroup$ +Very good. But our integral require integrate $[0,\infty]$. $\endgroup$ – Learner Jun 30 '19 at 15:43
  • $\begingroup$ Yes I know. Note that the aim of my answer was only to generalize the result from Claude Leibovici. His result was accepted even though it is for $[1,\infty]$ which is already very well. $\endgroup$ – JJacquelin Jun 30 '19 at 15:53
  • $\begingroup$ This is a nice answer ! Thanks for posting it & cheers :-) $\endgroup$ – Claude Leibovici Jun 30 '19 at 15:59
  • $\begingroup$ An interesting point about this answer is the zeroes of $f(p)=\int_1^\infty \frac{dx}{(x-\ln(x))^p}$. There's one positive zero around $0.537$ and it seems as though there's infinite negatively ones with fairly even gaps of about $2$: $-1.513, -3.501, -5.5, -7.5, -9.5, -11.5,\ldots$. $\endgroup$ – Jam Jul 3 '19 at 17:51
  • 1
    $\begingroup$ Sorry, but the OP wants to know $\int_0^\infty$ , not $\int_1^\infty$ . $\endgroup$ – user90369 Jul 17 '19 at 10:39

Long comment:

Following the original comment by @automaticallyGenerated it is astounding that $$I=\int_0^{\infty } \frac{1}{(x-\log (x))^p} \, dx= \frac{ 1}{\Gamma(p)} {\int_0^{\infty } \frac{\Gamma(x+1)}{x^{x-p+2}} \, dx}$$ seems to hold true for all real $p>1$. Since two entirely different functions are being integrated, it seems likely that the equality only holds when these bounds are used.

The second integral appears little help in understanding the first integral (the OP's integal). It doesn't appear to be amenable to substitution and all I found a way of expressing the second integral in terms of the incomplete Gamma function and generalized Laguerre polynomials $L_n^{(a)}(x)$ which doesn't seem to lead anywhere. (see https://en.wikipedia.org/wiki/Gamma_function )

$$\frac{ 1}{\Gamma(p)} {\int_0^{\infty } \frac{\Gamma(x+1)}{x^{x-p+2}} \, dx}=\frac{1}{\Gamma (p)}\int_0^{\infty } \frac{e^{-x} \Gamma (x+1) }{ \Gamma (x-p+2,x)} \sum _{n=0}^{\infty } \frac{ L_n^{(x-p+2)}(x) }{n+1}\, dx$$

In regard to the first integral above (the OP's integral). As has been shown this integral appears to split naturally into two halves $I_1$ and $I_2$. This is clearly shown by graphing the function $\frac{e^{1/y}}{\left(y \,e^{1/y} -1\right)^2}$, derived from the original function simply by substitutions.

Function produced via substitution

In the case of the new function $$I_1=\int_0^{\infty} \frac{e^{1/y}}{\left(y e^{1/y}-1\right)^2} \, dy\approx1.8798538622$$ $$I_2=\int_{-\infty}^0 \frac{e^{1/y}}{\left(y e^{1/y}-1\right)^2} \, dy\approx0.6380638008$$

as expected.

Most of the observations made so far have been directed to the first integral and its generalization to values of $p$ different to 2. I just note that $p$ can take any real value greater than $1$. Therefore the most general result for $I_1$ is

$$I_1=\int_1^{\infty } \frac{1}{(x-\log (x))^p} \, dx=\frac{ 1 }{\Gamma (p)} \sum _{n=1}^{\infty } \frac{\Gamma (n+p-1)}{(n+p-2)^n}$$

I shall make one further comment on the second integral.

It can be transformed as follows:

$$I_2=\int_0^{1 } \frac{1}{(x-\log (x))^p} \, dx=\int_{0}^{1 } \frac{1}{(1-x-\log (1-x))^p} \, dx$$

and rearranged $$I_2=\int_{0}^{1 } \frac{1}{(1-x)^2\left(1-\frac{\log (1-x)}{1-x}\right)^p} \, dx$$

The function $\left(1-\frac{\log (1-x)}{1-x}\right)$ has a reasonably simple infinite series expansion that is $$\left(1-\frac{\log (1-x)}{1-x}\right)=1+\sum_{k=0}^{\infty} \frac{\left| S_{k+1}^{(2)}\right| }{k!}x^k \approx 1+x+\frac{3 x^2}{2}+\frac{11 x^3}{6}+\frac{25 x^4}{12}+\frac{137 x^5}{60}+... $$

where $S_{n}^{(m)}$ are Sterling Numbers of the First Kind.

The infinite series expansion for the function $\frac{1}{(1-x-\log (1-x))^p}$ is not nearly quite so simple.

Update 1

I've become fascinated by the integral in question. In regard to roughly the function studied by @YuriyS I've spotted something else interesting, i.e.

$$I=\int_{-\infty}^\infty \frac{e^{-y} dy}{(e^{-y}+y)^2}$$

It is a slightly asymmetric function graphed here enter image description here

Numerically the $x$ value at which the curve peaks is $x\approx-0.4428544010$ which appears to the same as the decimal expansion of $x$ satisfying $x+2=exp(-x)$ (see https://oeis.org/A202322). I found the two numbers are the same to greater than 60 decimal places.

Update 2

I've managed to find a method of approximating $I_2$ with a series involving positive integer Logs, but amazingly not all integers, so far just the primes...

$$I_2\approx1+\left(\frac{-179592269512107561470980928 \log (2)-5712818723588970397783260 \log (3)+22992687372688767118775650 \log (5)-28209036610545300456578590 \log (7)+13 (677084947758213086002625 \log (11)+1829504980586239604457134 \log (13)+4782965 (286391006085468616 \log (17)+87040663716649545 \log (19))+3622722200873719994750 \log (23))}{4375992416738342400000}\right) $$

Hope recedes even further that the $I_2$ part of the integral has a closed form. Run out of time now, so will provide a further update later if I can make any sense of this.

Update 3

I should clarify that the surprise here is not log's of integers can be split into log's of their component primes, it is that highest log prime is related to the originating number of terms in the approximation (in the above case 25) and all the log primes below the highest are also present in the approximation.

This above observed property is connected to integrals of the form

$$a_n\int_0^1 x^n\,\text{li}(1-x) \, dx\tag{1}$$

where $\text{li}(x)$ is the logarithmic integral and $n$ is roughly the number of terms in the approximation.

The "order n" integral terms (1) arise from series approximations to the following integral for $I_2$ $$I_2=1+\int_0^1 \frac{ \left(2 \left(\frac{1}{\log (1-x)}-\frac{1}{\log ^2(1-x)}\right)\right)} {\left( \frac{1-x}{\log (1-x)}-1\right)^3} \, \text{li}(1-x) \, dx$$

This link to this problem to the integral of logarithmic integral over the interval $[0,1]$ was found using Mathematica and is at this time remains conjectural.

Update 4

It is interesting to note the integral $I_1$

$$I_1=\int_1^{\infty } \frac{1}{(x-\log (x))^p} \, dx=\frac{ 1 }{\Gamma (p)} \sum _{n=1}^{\infty } \frac{\Gamma (n+p-1)}{(n+p-2)^n}$$

appears to be one of a pair

$$\int_1^{\infty } \frac{1}{(x+\log (x))^p} \, dx=\frac{ 1 }{\Gamma (p)} \sum _{n=1}^{\infty } \frac{(-1)^{n-1}\Gamma (n+p-1)}{(n+p-2)^n}$$


Not a full answer, but I hope to add more once I get to Mathematica in a few hours.

Using an obvious substitution $x=e^y$, we can transform the integral to:

$$I=\int_{-\infty}^\infty \frac{e^y dy}{(e^y-y)^2}=\int_0^\infty \frac{e^y dy}{(e^y-y)^2}+\int_0^\infty \frac{e^{-y} dy}{(e^{-y}+y)^2}$$

Some simple algebra gives us:

$$I=2 \int_0^\infty \frac{(1+y^2) \cosh y~ dy}{(1-y^2+2 y \sinh y)^2}=\int_{-\infty}^\infty \frac{(1+y^2) \cosh y~ dy}{(1-y^2+2 y \sinh y)^2}$$

Consider a complex function:

$$f(z)=\frac{(1+z^2) \cosh z~ dz}{(1-z^2+2 z \sinh z)^2}$$

The function decays for $z$ approaching complex infinity. The denominator seems to have only $4$ complex roots:

$$z_{1,2}= \pm 0.3181315052047644297916272315 + 1.337235701430689443574992888 i$$

$$z_{3,4}= \pm 0.3181315052047644297916272315 - 1.337235701430689443574992888 i$$

So logically, if we choose a half-circle contour in either the upper or the lower half-plane, the integral can be found as the sum of two second order residues.

For the upper half-plane:

$$I=2 \pi i (r_1+r_2)$$


$$r_{1,2} = \lim_{z \to z_{1,2}} \frac{d}{dz} \left((z-z_{1,2})^2 f(z) \right) $$

I'll need Mathematica to numerically compute the residues and then check if this works.


I computed the residues at the poles in Mathematica, both by definition, using Limit and numerically using NResidue, from the Numerical Calculus Package.

The results agree and we have:

$$r_{1,2}= \pm 0.0157117544425405384700677892 \ldots -0.2026036954553989163697798003\ldots i$$

Which gives us:

$$2 \pi i (r_1+r_2)=4 \pi \cdot 0.2026036954553989163697798003\ldots= \\ =2.54599312493130005807440209 \ldots$$

While the integral is numerically:


Which doesn't agree in the third digit already.

I don't know what went wrong here, but I'll try to find out. To be fair, I checked a few similar functions with the same denominator, and the residue computations all agree with the integral only in the first $2-3$ digits and then disagree. So either the method requires much more precision or I'm missing something.

Update 2

The real and imaginary parts of $z_{1,2,3,4}$ have the same absolute values as in the number:


Which is a solution for $x=\log x$ which makes perfect sense when we consider the original integral.

I have used this exact value in Mathematica and found the residues exactly (the expressions are not pretty, but I found them).

However, I still get the same incorrect value $2.54599312493130005807440209 \ldots$ for the integral.

See That Guy's answer which explains my mistake and provides the explicit residue series.

  • $\begingroup$ But, I am looking for a closed form. $\endgroup$ – Learner Jul 17 '19 at 10:22
  • 1
    $\begingroup$ @Learner, there's most likely no closed form. If this method works out, then the integral will be expressed as an elementary function of the roots of $1-z^2+2 z \sinh z$. From numerical point of view, root finding is much easier than numerical integration, and allows practically unlimited precision. $\endgroup$ – Yuriy S Jul 17 '19 at 10:26
  • $\begingroup$ Okay. Can we prove that there is no closed form? $\endgroup$ – Learner Jul 17 '19 at 10:30
  • 3
    $\begingroup$ @Learner, for definite integrals there's no general method to prove that no closed form exists (though definitions of "closed form" can vary, depending on which special functions and constants are considered acceptable in the final answer) $\endgroup$ – Yuriy S Jul 17 '19 at 10:35


This is another non-answer, I find myself in agreement with what is written by Claude Leibovici.

Numerical experiment

Writing in Wolfram Mathematica:

int1 = NIntegrate[1/(x - Log[x])^2, {x, 0, ∞}, WorkingPrecision -> 100]

int2 = (WolframAlpha[ToString[int1], {{"PossibleClosedForm", 12}, 
         "FormulaData"}, PodStates -> {"PossibleClosedForm__More"}])[[1, 1]]

Abs[(int1 - int2)/(int1 + int2)] // PercentForm

we get:




that is, by means of known numerical techniques it is possible to obtain both decimal and rational results with amazing approximations, ie with a percentage error close to zero!


To Yuriy S: the method is good, you just forgot to consider all branches of Lambert W, the solution to $ e^x -x =0 $ is $ x_n= - W_{n}(-1) $ for $ n \in \mathbb{Z}$ so the integral is $$ 2\pi i \sum_{n=0}^{\infty} \text{Res}\left( \frac{e^x}{\left( e^x -x\right )^2}, -W_n(-1)\right) = 2\pi i \sum_{n=0}^{\infty} -\frac{W_n(-1)}{\left( 1+ W_n(-1)\right )^3} $$

Mathematica code:

Abs[Sum[NResidue[E^x/(E^x - x)^2, {x, -ProductLog[n, -1]},WorkingPrecision -> 50], {n, 0, 10000}]*2*Pi]

Real part of the sum converges VERY slowly to 0.

Sorry can't comment

  • $\begingroup$ Thank you, I forgot about branches. Should have known since we started with the logarithm $\endgroup$ – Yuriy S Jul 24 '19 at 10:51
  • $\begingroup$ The imaginary part of your series converges not that bad, for $50$ terms we have $4$ correct digits. Re[Sum[2 Pi I ProductLog[n, -1]/(1+ProductLog[n, -1])^3, {n, 0, 50}]] gives $2.51796$ $\endgroup$ – Yuriy S Jul 26 '19 at 8:37
  • $\begingroup$ It seems it has a logarithmic convergence rate $\endgroup$ – That Guy Jul 26 '19 at 15:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.