Integration by substitution of reciprocal of polynomial times logarithim $$\int  \frac 1 {\log_4^2 (x)} dx $$
I  used  $u = \log_4(x)$ and arrived at the solution $-\ln(4)/(\log _4 (x)) $, but I think this is wrong. How should I do it correctly? 
 A: I know this question was asked about 7 years ago, but it is never too late if the outcome is good!
First of all, change the base of the logarithm to the natural one, where $\log_b a = \log_x a/\log_x b$. Then,
$$
\int \frac{\mathrm{d}x}{\log_4^2 (x)} = \log^2(4) \int \frac{\mathrm{d}x}{\log^2 (x)}.
$$
If we set $u=\log x$, integrate by parts and only consider $x>0$,
$$
\int \frac{e^u\mathrm{d}u}{u^2} = -\frac{e^u}{u} + \int \frac{e^u\mathrm{d}u}{u} = -\frac{x}{\log x} + \int \frac{\mathrm{d}x}{\log x} = \mathrm{li}(x) -\frac{x}{\log x} + C,\tag{1}\label{eq:parts}
$$
where $\mathrm{li}(x)$ is the logarithmic integral defined as
$$
\mathrm{li}(x) = \begin{cases}
\displaystyle\int^x_0 \frac{\mathrm{d}t}{\log t} & \text{ if }\, 0 < x < 1, \\
\mathcal{P}\displaystyle\int^x_0 \frac{\mathrm{d}t}{\log t} & \text{ if }\, x > 1, \\
\end{cases}
$$
with $\mathcal{P}$ representing the Cauchy principal value of the integral. Therefore,
$$
\boxed{\int \frac{\mathrm{d}x}{\log_4^2 (x)} = \log^2(4) \left[\mathrm{li}(x) -\frac{x}{\log x} \right] + C \qquad \forall x>0.}
$$
We can generalize this result and solve the integral $\int \log^n(x) \mathrm{d}x$ for $n\in\mathbb{C}$. Taking $u = -\log x$,
$$
\begin{aligned}
\int \log^n(x) \mathrm{d}x &= -\int (-u)^ne^{-u} \mathrm{d}u = (-1)^{n+1} \int u^ne^{-u} \mathrm{d}u \\
&= (-1)^{n+1}\gamma(n+1, u) + C \\
&= (-1)^{n+1}\gamma(n+1, -\log x) + C \\
&= (-1)^n\Gamma(n+1, -\log x) + C,
\end{aligned}
$$
where we used the lower and upper incomplete gamma functions
$$
\gamma(a, x) = \int_0^x t^{a-1}e^{-t} \mathrm{d}t, \qquad \Gamma(a, x) = \int_x^\infty t^{a-1}e^{-t} \mathrm{d}t,
$$
respectively. Obviously, they satisfy that $\Gamma(a) = (a-1)! = \gamma(a, x) + \Gamma(a, x)$, being $\Gamma(a)$ the complete gamma function.
In particular, for a non-negative integer-valued $n$, one can compute the upper incomplete gamma function as
$$
\Gamma(n+1, -\log x) = n!x\sum_{k=0}^n\frac{(-\log x)^k}{k!}.
$$
For a negative integer-valued $n$ and defining $n=-m$, it is possible to continue iteratively with the followed process in \eqref{eq:parts} and see that
$$
\int \frac{\mathrm{d}x}{\log^m(x)} = \begin{cases}
\displaystyle\frac{1}{(m-1)!}\left[\mathrm{li}(x) - x\sum^{m-2}_{k=0} \frac{(m-k-2)!}{\log^{m-k-1}(x)}\right] + C & \text{ if }m\neq 1, \\
\mathrm{li}(x) + C & \text{ if }m = 1,
\end{cases}
$$
for $x>0$. Considering also negative values of $x$, we retrieve
$$
\int \frac{\mathrm{d}x}{\log^m(x)} = \begin{cases}
\displaystyle\frac{1}{(m-1)!}\left[\Gamma(0, -\log x) - x\sum^{m-2}_{k=0} \frac{(m-k-2)!}{\log^{m-k-1}(x)}\right] + C & \text{ if }m\neq 1, \\
\Gamma(0, -\log x) + C & \text{ if }m = 1,
\end{cases}
$$
where we have used the result cited here (see $\Gamma(-n, x)$ for positive integers $n$).
