Upper bound for $\prod_{p\leq x}\Big(1-\frac{1}{p}\Big)^{-1}$ In an analytic number theory textbook I found the exercise:
Proof $\prod_{p\leq x}\Big(1-\frac{1}{p}\Big)^{-1}= B\log(x) + O(1)$ with a fitting $B\in\mathbb{R}$.
Obviously I can write $$\prod_{p\leq x}\Big(1-\frac{1}{p}\Big)^{-1}=\sum_{n\leq x}\frac{1}{n} + \sum_{n>x, p\mid n\Rightarrow p\leq x} \frac{1}{n}$$ with $p$ being prime. I showed that
$$\sum_{n\leq x}\frac{1}{n} \leq 1+ \log(x) $$ and spend quite much time trying to find any upper bound for the second sum. It had various ideas but none of them worked out.
Then I got the idea to consider the product
$$\prod_{p\leq x} (1+\frac{1}{p}):(1-\frac{1}{p})^{-1}=\prod_{p\leq x} (1+\frac{1}{p})(1-\frac{1}{p})= \prod_{p\leq x} (1-\frac{1}{p^2})=O(1)$$ because this last product is converging for $x\to\infty$ (because the sum $\sum_{n=1}^\infty\vert{n^{-2}}\vert$ is converging, right?)
Since I already proved (in another exercise) that $$\prod_{p\leq x} (1+\frac{1}{p})=O(\log(x))$$
it immediately follows that $$\prod_{p\leq x}(1-\frac{1}{p})^{-1}= B\log(x)+O(1)=O(\log(x))$$
because the quotient is $O(1)$.
So my question is, is this above a valid argument to proof the statement?
And is there any "direct" way to estimate the right sum above? If so, I'd appreciate any hints on this.
 A: $$ \log\prod_{p\leqslant x}\left(1-\frac{1}{p}\right)=-\sum_{p\leqslant x}\frac{1}{p}+\sum_{p\leqslant x}\left(\log\left(1-\frac{1}{p}\right)+\frac{1}{p}\right) $$
The second sum converges because the general term is $\mathcal{O}\left(\frac{1}{p^2}\right)$, as for the first sum we have the estimation $\sum_{p\leqslant x}\frac{1}{p}=\log\log x+c+\mathcal{O}\left(\frac{1}{\log x}\right)$ for a constant $c$. Therefore, using the fact that the rest of the series $\sum\frac{1}{n^2}$ is a $\mathcal{O}\left(\frac{1}{n}\right)$, we have
$$ \log\prod_{p\leqslant x}\left(1-\frac{1}{p}\right)=-\log\log x+A+\mathcal{O}\left(\frac{1}{\log x}\right) $$
for a constant $A$. Finally,
$$ \prod_{p\leqslant x}\left(1-\frac{1}{p}\right)^{-1}=e^A \log x+\mathcal{O}(1) $$
A: This answer aims to determine the constant in the result proven in @Tuvasbien's answer:
$$
\prod_{p\le x}\left(1-\frac1p\right)^{-1}=e^\gamma\log x+O(1).
$$
where $\gamma$ is the Euler-Mascheroni constant. As @Tuvasbien has pointed out in his answer, it suffices to show that
$$
S(x)=\sum_{p\le x}\log\left(1-\frac1p\right)^{-1}=\log\log x+\gamma+O\left(1\over\log x\right).
$$
In fact, when $s\to1$ from the right, the function $\zeta(s)$ satisfies the identity:
$$
\zeta(s)=\prod_p\left(1-{1\over p^s}\right)^{-1}\sim{1\over s-1}.
$$
Taking logarithm on both side indicates that as $\delta\to0$, there is
\begin{aligned}
\log\zeta(1+\delta)
&=\log\frac1\delta+O(\delta)=\log{1\over1-e^{-\delta}}+O(\delta) \\
&=\sum_{n\ge1}{e^{-n\delta}\over n}+O(\delta).
\end{aligned}
Let $H(x)$ denote the sum of reciprocal of positive integers $\le x$:
$$
H(x)=\sum_{n\le x}\frac1n=\log x+\gamma+O\left(\frac1x\right).
$$
Then the above expression gets to transformed into an integral:
$$
\log\zeta(1+\delta)=\delta\int_0^\infty e^{-\delta t}H(t)\mathrm dt+O(\delta)\tag1
$$
For convenience, we introduce the following arithmetical function $a_n$:
$$
a_n=
\begin{cases}
1/kp^k & n=p^k,p\text{ prime} \\
0 & \text{otherwise}
\end{cases}
$$
so that $\log\zeta(s)$ can be transformed into
$$
\log\zeta(1+\delta)=\sum_p\sum_{k\ge1}{1\over kp^{k(1+\delta)}}=\sum_{n\ge1}{a_n\over n^\delta},
$$
and $S(x)$ can become
$$
S(x)=\sum_{p\le x}\sum_{k\ge1}a_{p^k}=\sum_{n\le x}a_n+R(x),
$$
where $R(x)$ satisfies
\begin{aligned}
|R(x)|
&=\sum_{p\le x}\sum_{k>\log_px}a_{p^k}\le\sum_{p\le x}\sum_{k>\log_px}{1\over p^k} \\
&=\sum_{p\le x}\sum_{m\ge0}{1\over p^{m+\lceil\log_p x\rceil}}\le\frac1x\sum_{p\le x}{1\over1-p^{-1}} \\
&\le\frac1x\sum_{p\le x}2={2\pi(x)\over x}=O\left(1\over\log x\right).
\end{aligned}
Consequently, it follows from @Tuvasbien's answer that
$$
S_2(x)=\sum_{n\le x}a_n=\log\log x+A+O\left(1\over\log x\right).
$$
Now, using the fact that
\begin{aligned}
\log\zeta(1+\delta)
&=\sum_{n\ge1}{a_n\over n^\delta}=\delta\int_1^\infty x^{-\delta}S_2(x){\mathrm dx\over x} \\
&=\delta\int_0^\infty e^{-\delta t}S_2(e^t)\mathrm dt
\end{aligned}
Combining this with (1) gives
\begin{aligned}
\log\zeta(1+\delta)-\log{1\over1-e^{-\delta}}
&=\delta\int_0^\infty e^{-\delta t}[S_2(t)-H(t)]\mathrm dt \\
&=A-\gamma+O\left\{\delta\int_0^\infty{e^{-\delta t}\over t+1}\mathrm dt\right\}
\end{aligned}
Finally, using the fact that
\begin{aligned}
\int_0^\infty{e^{-\delta t}\over t+1}\mathrm dt
&=\int_0^T{e^{-\delta t}\over t+1}\mathrm dt+O\left\{\int_T^\infty{e^{-\delta t}\over t}\mathrm dt\right\} \\
&=O(T)+O\left\{\int_{\delta T}{e^{-u}\over u}\mathrm du\right\} \\
&=O(T)+O\left(1\over\delta T\right).
\end{aligned}
Plugging this back with $T=\delta^{-1/2}$ gives us
$$
\log\zeta(1+\delta)-\log{1\over1-e^{-\delta}}=A-\gamma+O(\delta^{1/2})
$$
Since the left hand side is $O(\delta)$ when $\delta\to0$, we conclude that $A=\gamma$, thereby proving the identity stated in the front of this answer.
