The question is: does the set of prime numbers $q$ such that $\sum\limits\_{p\leq\sqrt{q}}p=\pi(q)$, where $p$ are prime numbers, contain infinitely many elements? You can find the first elements here (<http://oeis.org/A329403>). Any insight on this would be welcomed.


Thanks in advance for your time and effort!



Set of prime numbers $q$ such that $\sum\limits_{p\leq\sqrt{q}}p=\pi(q)$, where $p$ are prime numbers
Nice question! The answer is affirmative. If $\sigma(x)$ denotes the sum of primes up to $\sqrt{x}$, then it suffices to show that $\pi(x)-\sigma(x)$ changes sign infinitely often, because
$$\pi(x)-\sigma(x)<0<\pi(x+1)-\sigma(x+1)$$
never holds. I thank Juan Moreno and Will Sawin for this simple but crucial observation. My streamlined argument below owes to reuns' ideas as well.


Let us introduce the notation
$$\pi(x)=\mathrm{li}(x)-\mathrm{li}(1)+\rho(x),$$
then we get
\begin{align\*}\sigma(x)
&=\int\_1^\sqrt{x}t\,d\pi(t)\\
&=\int\_1^\sqrt{x}\frac{t\,dt}{\log t}+\int\_1^\sqrt{x} t\ d\rho(t)\\
&=\int\_1^x\frac{du}{\log u}+\int\_1^\sqrt{x} t\ d\rho(t)\\
&=\mathrm{li}(x)-\mathrm{li}(1)+\int\_1^\sqrt{x} t\ d\rho(t).
\end{align\*}
So the difference $\pi(x)-\sigma(x)$ can be directly estimated by the error term in the prime number theorem. We can analyze this difference further by considering the Mellin transform
$$\int\_1^\infty x^{-s}\ d(\pi(x)-\sigma(x))=\int\_1^\infty(x^{-s}-x^{1-2s})\ d\rho(x).$$
We shall only need to look at the left-hand side. Integrating by parts, we see that it is holomorphic in a region containing the half-plane $\Re(s)>1$ and the half-line $s>2/3$. In fact, in this region, the left-hand side equals
$$\log\zeta(s)-\log\zeta(2s-1)+\frac{1}{2}\log\zeta(4s-2)+f(s),\tag{$\ast$}$$
where $f(s)$ is holomorphic for $\Re(s)>2/3$.
As in the proof of Theorem 15.2 in Montgomery-Vaughan: Multiplicative number theory I, this eventually yields that
$$\pi(x)-\sigma(x)=\Omega\_\pm(x^c)\quad\text{for any}\quad c<3/4.$$
Indeed, let us assume that this bound fails for some $c<3/4$. Without loss of generality, $c>2/3$. Then, by Landau's lemma (which is Lemma 15.1 in the same book), $(\ast)$ is holomorphic in the half-plane $\Re(s)>c$. However, this is easily seen to be false, and we are done.


