TITLE: Proof of Mertens' formula
QUESTION [0 upvotes]: $$\sum_{p\leq x}\frac{1}{p} = \log(\log x) + a+ O\left(\frac{1}{\log x}\right)$$
$$ a=\int_{2}^{\infty}R(u)\frac{du}{u(\log u)^2} +1- \log(\log 2)$$




$$ e^{-1/p}(1-1/p)^{-1}= 1+O(1/p^2)$$


Below is the expression that needs to be proved
$$ \prod_{p\leq x}(1-1/p)^{-1}= b\log x + O(1),$$
with $b=e^{a}\prod_{p} e^{-1/p}(1-1/p)^{-1}$.
I have tried proving that but up until now I was not able to succeed. This is how I proceeded:
$$
\begin{split}
\prod_{p\leq x}(1-1/p)^{-1} &= \prod_{p\leq x}e^{1/p}e^{-1/p}(1-1/p)^{-1}\\
 & = e^{\sum_{p\leq x}1/p}\prod_{p\leq x}e^{-1/p}(1-1/p)^{-1}\\
  &= \log x\cdot e^{a}\cdot e^{O(1/\log x)}\prod_{p\leq x}e^{-1/p}(1-1/p)^{-1}\\
&= \frac{e^{O(1/\log x)}(\log x\cdot e^{a}\prod_{p}e^{-1/p}(1-1/p)^{-1})}{\prod_{p> x}e^{1/p}e^{-1/p}(1-1/p)^{-1}}
\end{split}
$$
I do not know how to proceed further.

REPLY [7 votes]: Your last display is incorrect: it should be
$$\frac{e^{O(1/\log x)}\big(\log x\cdot e^{a}\prod_{p}e^{-1/p}(1-1/p)^{-1}\big)}{\prod_{p> x}e^{-1/p}(1-1/p)^{-1}}.$$
From here it is easy to finish. The first factor in the numerator is $1+O(1/\log x)$, while the denominator is
$$\exp\left(\sum_{p>x}O(1/p^2)\right)=\exp\bigl(O(1/x)\bigr)=1+O(1/x).$$
So altogether the above expression is
$$(b\log x)\bigl(1+O(1/\log x)\bigr)=b\log x+O(1).$$
Done.
{"set_name": "stack_exchange", "score": 0, "question_id": 386392}