TITLE: Maximize $W(x) - (\ln(x) - \ln{\ln{x}})$
QUESTION [6 upvotes]: How can you maximize $f(x) = W(x) - (\ln(x) - \ln{\ln{x}})$ for $x\geq 2$?  
Numerically the answer seems to be at around $x \approx 41$ where you get $f(41) \approx 0.31$. Mathematica suggests the maximum is at $x= e^{1+e}$.
$W$ is the Lambert-W function.

REPLY [4 votes]: Using the fact that
$$
W'(x) = \frac{W(x)}{x(1+W(x))}
$$
we calculate
$$
f'(x) = \frac{W(x)+1-\ln x}{x\ln x(1+W(x))},
$$
so to optimize $f$ we want to solve the equation
$$
W(x)+1 = \ln x.
$$
Exponentiating both sides yields
$$
e e^{W(x)} = x,
$$
and after multiplying both sides by $W(x)$ this becomes
$$
e W(x) e^{W(x)} = x W(x).
$$
Since $W(x)e^{W(x)} = x$ this is equivalent to
$$
ex = xW(x)
$$
or just
$$
W(x) = e.
$$
Thus
$$
x = ee^e = e^{1+e}.
$$
Plugging this back into the function we get
$$
f(e^{1+e}) = \ln(1+e) - 1.
$$