Asymptotics of a sieve-like sum over primes

64 Views Asked by At

While trying to analyze the running time of some algorithm, I arrived at this expression as a function of $n$ (where $p$ varies over prime numbers):

$$\sum_{p \le \sqrt{n}} \left(\max(0, \sqrt{n} - p^2) + \min\bigl(\frac{n}{p^2}, \sqrt{n}\bigr)\right)$$

What is this asymptotic to, for large $n$?


Here's what I've tried: The sum is equal to

$$\sum_{p\le\sqrt{n}}\sqrt{n} - \sum_{p\le\sqrt{n}}p^2 + \sum_{p \le n^{1/4}}\sqrt{n} + \sum_{n^{1/4} < p \le \sqrt{n}} \frac{n}{p^2}$$

which is the same as

$$\sqrt{n}\pi\left(\sqrt{n}\right) - \sum_{p\le\sqrt{n}}p^2 + \sqrt{n}\pi(n^{1/4}) + n\sum_{n^{1/4} < p \le \sqrt{n}} \frac{1}{p^2}$$

where we can get further using $\pi(x) \sim \frac{x}{\ln x}$, but I haven't looked closely into the other two terms.

1

There are 1 best solutions below

1
On BEST ANSWER

If $p\leq n^{1/4}$ then the summand is $2\sqrt{n}-p^2$, so this contributes

$$ 2\sqrt{n}\pi(n^{1/4})-\sum_{p\leq n^{1/4}}p^2 \sim 8\frac{n^{3/4}}{\log n}-n^{1/2}\pi(n^{1/4})+2\int_1^{n^{1/4}}\pi(t)t\mathrm{d}t $$ which is

$$ \sim 4\frac{n^{3/4}}{\log n} + 2 \int_1^{n^{1/4}}\frac{t^2}{\log t}\mathrm{d}t\sim 12\frac{n^{3/4}}{\log n}.$$

If $p>n^{1/4}$ the summand is $n/p^2$, so this contributes

$$ n\sum_{n^{1/4}<p\leq n^{1/2}}\frac{1}{p^2}$$

and since

$$\sum_{p\leq y}\frac{1}{p^2}\sim C -\frac{1}{y\log y}$$

this contribution is

$$ \sim 4\frac{n^{3/4}}{\log n}.$$

In total, therefore, the sum is

$$ \sim 16 \frac{n^{3/4}}{\log n}.$$

(In these calculations I used the prime number theorem $\pi(x)\sim x/\log x$ and consequences of it via partial summation for the sums over primes.)