The Prime Number Theorem relates primes to the important constant $e$.

Here I report my following surprising discovery which relates primes to $\pi$.

Conjecture (December 15, 2019). Let $s(n)$ be the sum of all primes $p\le n$ with $p\equiv1\pmod4$, and let $s_*(n)$ be the sum of those $x_py_p$ with $p\le n$, where $p$ is a prime congruent to $1$ modulo $4$, and $p=x_p^2+y_p^2$ with $x_p,y_p\in\{1,2,3,\ldots\}$ and $x_p\le y_p$. Then $$\lim_{n\to+\infty}\frac{s(n)}{s_*(n)} = \pi.$$

Recall that a classical theorem of Euler (conjectured by Fermat) states that any prime $p\equiv1\pmod4$ can be written uniquely as $x^2 + y^2$ with $x,y\in\{1,2,3,\ldots\}$ and $x\le y$. Since $x^2 + y^2 \ge 2xy$ for any real numbers $x$ and $y$, we have $s(n) \ge 2s_*(n)$ for all $n=1,2,3,\ldots$.

I have created the sequence $(s_*(n))_{n>0}$ for OEIS (cf. http://oeis.org/A330487). Via computation I found that $$s(10^{10}) = 1110397615780409147,\ \ s_*(10^{10}) = 353452066546904620, $$ and $$ 3.14157907 < \frac{s(10^{10})}{s_*(10^{10})} < 3.14157908. $$ This looks an evidence to support the conjecture.

QUESTION. Is my above conjecture true? If true, how to prove it?

Any further check of the conjecture is welcome!

  • 1
    $\begingroup$ Dear GH from MO, thank you for your clever answer. I cannot even find your e-mail address. Would you please send me an e-mail so that we may discuss more on such topics? $\endgroup$ Dec 16, 2019 at 11:18
  • 5
    $\begingroup$ Thanks for your kind words and the nice conjecture. I prefer to remain anonymous and pursue discussions at this site. If I see an interesting question, and I have the ability and time to answer it, I will answer it. $\endgroup$
    – GH from MO
    Dec 16, 2019 at 11:28
  • 1
    $\begingroup$ I conjecture further that $$\frac{s_*(n)}{s(n)}=\frac1{\pi}+O\left(\frac1{\sqrt n}\right).$$ $\endgroup$ Dec 16, 2019 at 15:50
  • 4
    $\begingroup$ I think that an error term $O(n^{-1/2})$ is too ambitious, the truth is probably $O(f(n)n^{-1/2})$ and $\Omega_{\pm}(f(n)n^{-1/2})$ with some slowly increasing $f(n)\to\infty$. But to prove that one probably needs the Riemann Hypothesis for the relevant Hecke $L$-functions. By analogy, a good error term for $\pi(x;q,a)/\pi(x)$ is hard to obtain. $\endgroup$
    – GH from MO
    Dec 16, 2019 at 20:19
  • 3
    $\begingroup$ Motivated by this question, I found a related conjecture. The ratio of the sum of the squares of the hypotenuse to the sum of the area of all Pythagorean triangles in which the hypotenuse is a prime number is $2\pi$. Posted in MSE: math.stackexchange.com/questions/3481766/… $\endgroup$ Dec 19, 2019 at 12:10

1 Answer 1


Here is a proof of the conjecture. We shall use Hecke's theorem that the angles of the lattice points $(x_p,y_p)$ are asymptotically equidistributed in $[\pi/4,\pi/2]$, cf. this MO post.

Let $t_p\in[\pi/4,\pi/2]$ be the angle of the lattice point $(x_p,y_p)$. Let us divide the interval $[\pi/4,\pi/2]$ into $R$ subintervals of equal length, where $R$ is large but fixed. For $r\in\{1,\dotsc,R\}$, the $r$-th subinterval is $$I_r:=[u_{r-1},u_r]\qquad\text{with}\qquad u_r:=\frac{\pi}{4}\left(1+\frac{r}{R}\right).$$ Observe that $$\frac{\sin(2u_r)}{2}\sum_{\substack{p\leq n\\t_p\in I_r}}p\leq \sum_{\substack{p\leq n\\t_p\in I_r}}x_p y_p\leq \frac{\sin(2u_{r-1})}{2}\sum_{\substack{p\leq n\\t_p\in I_r}}p.$$ By the quoted equidistribution theorem, $$\sum_{\substack{p\leq n\\t_p\in I_r}}p\sim\frac{s(n)}{R}\qquad\text{as}\qquad n\to\infty,$$ and so we infer that $$\frac{1}{R}\sum_{r=1}^R\frac{\sin(2u_r)}{2}\leq \liminf_{n\to\infty}\frac{s_\ast(n)}{s(n)}\leq \limsup_{n\to\infty}\frac{s_\ast(n)}{s(n)}\leq \frac{1}{R}\sum_{r=1}^R\frac{\sin(2u_{r-1})}{2}.$$ By letting $R\to\infty$, both sides tend to $$\frac{4}{\pi}\int_{\pi/4}^{\pi/2}\frac{\sin(2u)}{2}\,du=\frac{1}{\pi},$$ whence $$\lim_{n\to\infty}\frac{s_\ast(n)}{s(n)}=\frac{1}{\pi}.$$

  • $\begingroup$ I check those p is the sum of three squares, such as $3=1^2 + 1^2 + 1^2,29=2^2 + 3^2 + 4^2$, it seems $$\lim_{n\to+\infty}\frac{s(n)}{s_*(n)} = 1?$$ $\endgroup$
    – Mike
    Dec 17, 2019 at 11:50
  • 1
    $\begingroup$ @Mike: If $p\equiv 3\pmod{8}$, then $p$ is a some of three squares but not a sum of two squares. For such primes $p$, the quantities $x_p$ and $y_p$ are not defined. $\endgroup$
    – GH from MO
    Dec 17, 2019 at 12:47
  • $\begingroup$ I check the data time again, those $p$ not include primes also can be the sum of two squares, and $x_py_pz_p$ is if $x_p+y_p+z_p$ is the min one. $\frac{s(n)}{s_*(n)}$ is close to $1$ when $n$ go large, I don't know if the value will less than $1$ when $n$ is sufficiently large. If only check primes is the sum of three consecutive squares,I believe there's a constant. $\endgroup$
    – Mike
    Dec 18, 2019 at 9:04
  • 1
    $\begingroup$ @Mike: I think you did not understand my point.The definition of $s(n)$ and $s^\ast(n)$ only involves primes that can be written as a sum of two squares. If you want to talk about an analogous question involving primes which can be written as a sum of three squares, then you need to modify the definition of $s(n)$ and $s^\ast(n)$ first. So I suggest that you open a new question, starting with precise (new) definitions tailored for your situation. $\endgroup$
    – GH from MO
    Dec 18, 2019 at 14:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.