Are there infinite many $n\in\mathbb N$ such that $$\pi(n)=\sum_{p\leq\sqrt n}p,\tag{1}$$ where $\pi(n)$ is the Prime-counting_function?

For example, $n=1,4,11,12,29,30,59,60,179,180,389,390,391,392,\dots$

As I know, $\pi(x)\sim \dfrac{x}{\ln x},\sum_{p\leq x}p\sim \dfrac{x^2}{2\ln x}$, hence $\pi(x)\sim \sum_{p\leq \sqrt x}p$.

It seems that

  • 1) it's very often that $\pi(n)>\sum_{p\leq\sqrt n}p$,
  • 2) there are infinite many primes $q$ such that $q>\pi(q^2)-\sum_{p<q}p.$

If we can prove 1) and 2) then we get (1), but I can't prove even one of them.

Thanks in advance!

Edit: Use the formula given by Balarka Sen, I get $$\pi(x)\sim \sum_{p\leq\sqrt x}p = \frac{x}{\ln x}(1+\frac{1+o(1)}{\ln x}),$$ but it's not enough to solve our problem.

Edit2: Use the formula given in Dusart's paper and this paper (or this post), I get $$\pi(x)=\frac{x}{\ln x}(1+\frac{1}{\ln x}+\frac{2}{(\ln x)^2}+O(\frac{1}{(\ln x)^3}))\tag 2$$

$$\sum_{p\leq\sqrt x}p =\frac{x}{\ln x}(1+\frac{1}{\ln x}+o(\frac{1}{(\ln x)^2})),\tag 3$$ so 1) is true but 2) is not, and there are only finite many $n$ satisfy $(1)$.

  • 15,458
  • 5
  • 34
  • 87
  • 2
    There should not be. Heuristics suggests $$\sum_{p\leq \sqrt{n}} p \leq \frac{n}{\log n} \left (1 + \frac{1}{\log(n)} + \frac{16.08}{\log(n)^2} \right)$$ for some $n \geq N$ and the error with $\frac{1.25 \cdot n}{\log(n)}$, the supermum of $\pi(n)$, sign changes only finitely often. – Balarka Sen Dec 23 '13 at 07:48
  • 1
    @Balarka Sen Thanks! Where can I find that formula? – lsr314 Dec 23 '13 at 08:13
  • I think your formula about $\pi(n)$ is false. – lsr314 Dec 23 '13 at 08:27
  • You are referring to "upper bound" instead of "formula", is that right? I believe my bound is correct. See http://en.wikipedia.org/wiki/Prime-counting_function#Inequalities – Balarka Sen Dec 23 '13 at 08:32
  • 1
    @Balarka Sen I want to see the formula of $\sum_{p\leq\sqrt n}p$. The inequality of $\pi(n)$ is correct, but I think you confuse the difference between supermum and upper bound, since $\lim_{n\to \infty}\frac{\pi(n)\ln n}{n}=1,$ I don't know how can you get that the sign of $\pi(n)-\sum_{p\leq\sqrt n}p$ changes only finitely often. – lsr314 Dec 23 '13 at 12:51
  • Ah, yes, I meant upper bound instead of supermum, a typo. Give me a minute or two, I'll type the derivation of the formula for $\sum_{p\leq n}p$. And as I have said, I am not claiming $\pi(n)-\sum_{p\leq\sqrt n}p$ sign changes finitely often but that their (tight) upper bounds does; that's why I said it was a heuristic. – Balarka Sen Dec 23 '13 at 13:04
  • Okay, now about the upper bound I derived for $\sum_{p \leq n}p$, I used [Dusart's](http://www.unilim.fr/laco/theses/1998/T1998_01.pdf) bounds on $\pi(n)$ and then apply integration by parts. (EDIT : I just found out [this paper](http://arxiv.org/pdf/1011.1667.pdf) which seems to be of general interest and gives far better bounds on sum of primes.) – Balarka Sen Dec 23 '13 at 13:15
  • 7
    @BalarkaSen: You won't be able to disprove this conjecture by using asymptotic estimates alone. By the prime number theorem combined with partial summation $$\sum_{p\leq x}1=\int_{2}^{x}\frac{1}{\log t}dt+O\left(xe^{-c\sqrt{\log x}}\right)$$ and $$\sum_{p\leq\sqrt{x}}p=\int_{2}^{\sqrt{x}}td\left(\pi(t)\right)=\int_{2}^{\sqrt{x}}\frac{t}{\log t}dt+O\left(xe^{-c\sqrt{\log x}}\right),$$ Letting $t=\sqrt{u}$, we have that $$\int_{2}^{\sqrt{x}}\frac{t}{\log t}dt=\int_{4}^{x}\frac{1}{\log u}du,$$ and so $$\left|\sum_{p\leq x}1-\sum_{p\leq\sqrt{x}}p\right|=O\left(xe^{-c\sqrt{\log x}}\right) .$$ – Eric Naslund Dec 23 '13 at 17:46
  • 3
    I believe the conjecture is true. The only way I can think of approaching this problem is to modify Littlewood's 1914 proof that $$\pi(x)-\text{li}(x)=\Omega_{\pm}(\sqrt{x}\log \log \log x),$$ and show that it works even when we have multiple different error terms. – Eric Naslund Dec 23 '13 at 17:56
  • Plotting the number of solutions to the problem below a given N we get this plot: http://de.tinypic.com/view.php?pic=315xs7m&s=8#.VEYo5hY08UM . It looks like there might be infinitly many solutions. – Michael Stocker Oct 21 '14 at 09:37

1 Answers1


I think they are finite :

$$\sum_{p\leq\sqrt{x}}p=\int_{2^{+}}^{\sqrt{x}}td\left(\pi(t)\right)= \sqrt{x}\pi(\sqrt{x}) -\int_{2}^{\sqrt‌​{x}}\pi (t)dt$$

suppose we have the equality for infinitely many $x$:

$$\pi(x)= \sqrt{x}\pi(\sqrt{x}) -\int_{2}^{\sqrt‌​{x}}\pi (t)dt$$

$$\sqrt{x}\pi(\sqrt{x}) - \pi(x)= \int_{2}^{\sqrt‌​{x}}\pi (t)dt$$

for $x > 55^{2}$ : $$ \sqrt{x}\frac{\sqrt{x}}{log(\sqrt{x})-4}- \frac{x}{log(x)+2} >\sqrt{x}\pi(\sqrt{x}) - \pi(x)$$

$$ \int_{2}^{\sqrt‌​{x}}\pi (t)dt > \int_{55}^{\sqrt‌​{x}} \frac{t}{log(t)+2}dt +C = e^{-4}\operatorname{Ei}(2(log(\sqrt{x})+2))+C $$

and :

$$ e^{-4}\operatorname{Ei}(2(log(\sqrt{x})+2))+C >> \sqrt{x}\frac{\sqrt{x}}{log(\sqrt{x})-4}- \frac{x}{log(x)+2} $$ so we get a contradiction ..

What do you think ? did I miss something ?

(note : I used the fact that for $x > 55$ :

$$\frac {x}{\ln x + 2} < \pi(x) < \frac {x}{\ln x - 4} $$)

According to my computation the list should stop at 4000 or 5000 ..

  • 4
    Haven't gone through your calclations, but I found quite alot examples above 5000. I searched up to $n = 2·10^9$ and the largest solution I found was 1,869,604,906. – Michael Stocker Oct 21 '14 at 09:16
  • Thank you. I'll keep my "answer" for other people to see if there a way to use it. if somebody can find a solution I would love to see it. – Naoufal EL JAOUHARI Nov 17 '14 at 08:57