# The behaviour of $\sum_{\mathcal{R}\leq x}\left\{\frac{x}{\mathcal{R}}\right\}$, where $\mathcal{R}$ denote Ramanujan primes

Here we denote with $\left\{x\right\}$ the fractional part function, and being $R_n$ for $n\geq 1$ the sequence of Ramanujan primes, see this Wikipedia, with the notation $\mathcal{R}\leq x$ we mean the subset of Ramanujan primes less than $x$.

Question. I would like to know how to deduce a statement about the asymptotic behaviour (to me is enough a simple statement using big oh notation) of $$\sum_{\mathcal{R}\leq x}\left\{\frac{x}{\mathcal{R}}\right\}.\tag{1}$$ Thanks in advance.

Only is required to provide hints or those details more complicated being specific in the manipulation or technique for our exercise. If it is known from the literature, answer this as a reference request.

Let $\mathcal{R}$ denote the set of Ramanujan primes, $\pi_{\mathcal{R}}(x)$ the number of Ramanujan primes less than $x$, and $$\theta_{\mathcal{R}}(x)=\sum_{\begin{array}{c} p\leq x\\ p\in \mathcal{R} \end{array}}\log p.$$ Then, writing this as a Riemann-Stieltjes integral, this will be $$\sum_{\begin{array}{c} p\leq x\\ p\in\mathcal{R} \end{array}}\left\{ \frac{x}{p}\right\} =\int_{2}^{x}\frac{1}{\log t}\left\{ \frac{x}{t}\right\} d\theta_{\mathcal{R}}(t).$$ To understand this quantity, we need to understand the number of Ramanujan primes less than $x$. The $n^{th}$ Ramanujan prime is the smallest integer $R_{n}$ such that $\pi(x)-\pi(x/2)\geq n$ for all $x\geq R_{n}$. Now, since $\pi(x)=\frac{x}{\log x}+O\left(\frac{x}{\log^{2}x}\right),$ it follows that $$\pi(x)-\pi(x/2)=\frac{x}{2\log x}+O\left(\frac{x}{\log^{2}x}\right).$$ The number of Ramanujan primes less than $x$, $\pi_{\mathcal{R}}(x)$, is equal to the largest $n$ such that $\pi(y)-\pi(y/2)\geq n$ for all $y\geq x$. By the above asymptotics, it follows that $$n=\pi_{\mathcal{R}}(x)=\frac{x}{2\log x}+O\left(\frac{x}{\log^{2}x}\right),$$ and by partial summation, we have that $$\theta_{\mathcal{R}}(x)=\frac{x}{2}+O\left(\frac{x}{\log x}\right).$$ Hence, by using integration by parts and bounding error terms in the partial summation above, we have that $$\sum_{\begin{array}{c} p\leq x\\ p\in\mathcal{R} \end{array}}\left\{ \frac{x}{p}\right\} =\frac{1}{2}\int_{2}^{x}\frac{1}{\log t}\left\{ \frac{x}{t}\right\} dt+O\left(\frac{x}{\log^{2}x}\right).$$ In other words, $$\sum_{\begin{array}{c} p\leq x\\ p\in\mathcal{R} \end{array}}\left\{ \frac{x}{p}\right\} =\frac{1}{2}\sum_{p\leq x}\left\{ \frac{x}{p}\right\} +O\left(\frac{x}{\log^{2}x}\right).$$