8
$\begingroup$

From Prime Number Theorem and this we can state $$\frac{p_n}{\bar{p}}\sim 2$$ or $$\lim_{n\to \infty} \frac{np_n}{(p_1 + \dots +p_n)} = 2$$

If we then look at the fluctuations in the graph of $$f(n) = \frac{np_n}{(p_1 + \dots +p_n)}$$ so that $$g(n) = \left|\space f(n) - f(n-1)\right|$$ we get the following plotenter image description here

Now this plot is interesting to me for two reasons:

  • it seems to divide the prime numbers into groups that tend to follow a certain function
  • the graphs of each of those functions seem to shift on the x-axis by a factor of $\tau$ (or $2\pi$).

I'm no mathematician, so I'd like to know if these findings correspond to any known theorems or if they have any truth or significance at all.

(This is related to my earlier question on this subject)

Extra
Here is the similar looking graph for the difference between the error terms of $p_n \sim n\log(n)$ for $n$ and $n-1$.

second graph

$\endgroup$
6
  • 1
    $\begingroup$ You should probably make mention of your earlier variant of this question at math.stackexchange.com/questions/1409219/… -- they're not exact duplicates, but they're very closely related. $\endgroup$ Aug 31 '15 at 15:42
  • $\begingroup$ A very aesthetic picture indeed! $\endgroup$
    – Peter
    Aug 31 '15 at 16:45
  • $\begingroup$ I have never seen this limit. So, there is a very nice way to approximate the SUM of the first $n$ primes. Is anything known about the error term ? $\endgroup$
    – Peter
    Aug 31 '15 at 16:55
  • 1
    $\begingroup$ Reading the equation in the form $$\frac{\sum_{j=1}^n p_j}{n}\approx \frac{p_n}{2}$$ allows the interpretation : The average of the first $n$ prime numbers if about the half of the $n-th$ prime number, so in some sense, the primes are symmetric distributed around the half of the $n-th$ prime. $\endgroup$
    – Peter
    Aug 31 '15 at 17:01
  • $\begingroup$ The inequality $f(10^8)>2.05$ shows how slow the function tends to $2$. $\endgroup$
    – Peter
    Aug 31 '15 at 17:31
1
$\begingroup$

There is something worth explaining in the regularity of the fishnet pattern with the dangling spikes in the OP's graph. I don't know what the explanation is, but I thought it'd be worth writing up some observations, in hopes that someone with keener analytic eyes than mine will pick up where I leave off.

Let me begin with a bit of notation. Since the OP is interested in the ratio of the $n$th prime to the average of the first $n$ primes, let's write

$$R_n={np_n\over p_1+\cdots+p_n}$$

The OP is graphing the function

$$\Delta(n)=|R_n-R_{n-1}|$$

I'm using $\Delta$ instead of $g$ for this function because I want to use $g$ to denote the gap between primes. It's possible to rewrite $R_{n-1}$ in terms of $n$, $R_n$, $p_n$ and $g_n=p_n-p_{n-1}$. The result is

$$\Delta(n)={R_n\over|n-R_n|}\left|{(n-1)g_n\over p_n}-(R_n-1) \right|$$

This formula has a nicer appearance if we dispense with the subscript (but, of course, keeping in mind that it's really there):

$$\Delta(n)={R\over|n-R|}\left|{(n-1)g\over p}-(R-1) \right|$$

Let's now recall that the ratio $R_n$ tends to $2$ as $n\to\infty$, so we can write $R=2+\epsilon$, with the understanding that $\epsilon=\epsilon_n\to0$. This gives

$$\Delta(n)={2+\epsilon\over|n-2-\epsilon|}\left|{(n-1)g\over p}-1-\epsilon \right|$$

Since the graph uses a logarithmic vertical scale, it makes sense to take logs here. If we also do a little approximating, we have

$$\begin{align} \log(\Delta(n))&=\log(2+\epsilon)-\log|n-2-\epsilon|+\log\left|{(n-1)g\over p}-1-\epsilon \right|\\ &\approx\log2-\log n+ \log\left|{(n-1)g\over p}-1-\epsilon \right| \end{align}$$

Now the first two terms here, $\log2-\log n$, accord with the overall downward slope of the graph. (Actually, as Peter has observed, $\epsilon$ takes its time getting small, so we should probably keep it in the $\log(2+\epsilon)$. But its local effect is merely to shift the entire graph up or down.) The fuzziness, the fishnet, and the spikes, must be coming from the third term.

Note that $p=p_n\approx n\log n$, so we can write

$${(n-1)g\over p}-1-\epsilon={g\over\log n}-1-\epsilon'$$

where $\epsilon'=\epsilon_n'$ now incorporates the errors of two approximations. Now with some regularity, the gap between primes is fairly small, e.g., $g=2$ for the occasional twin primes, in which case the third term contributes next to nothing. I think that goes a long way toward explaining the fairly thick fuzz near the top of the graph.

Furthermore, since the average gap between primes is roughly $\log n$, we can expect the third term to occasionally be the log of a small number, which produces points well below the fuzz. But why the pattern is so regular still seems mysterious.

$\endgroup$
0
$\begingroup$

Reading the approximation in the way :

$$\large \frac{\sum_{j=1}^n p_j}{n}\approx \frac{p_n}{2}$$

allows the interesting interpretation : The arithmetic mean of the first $n$ primes is about the half of the $n-th$ prime, so in some sense, the first $n$ primes are symmetrically distributed around the half of the $n-th$ prime.

Note, that the function is converging very slowly. This can be seen from $$f(10^8)>2.05$$

The local maxima upto the probable global maximum of $f$ are shown by the following PARI/GP-program:

? maxi=0;s=0;t=1;for(n=1,10^8,merk=s;t=nextprime(t+1);s=s+t;if(n*t/s>maxi,maxi=n
*t/s;print(n,"   ",t,"   ",s,"    ",n*t/s,"   ",1.0*n*t/s)))

1   2   2    1   1.000000000000000000000000000
2   3   5    6/5   1.200000000000000000000000000
3   5   10    3/2   1.500000000000000000000000000
4   7   17    28/17   1.647058823529411764705882353
5   11   28    55/28   1.964285714285714285714285714
7   17   58    119/58   2.051724137931034482758620690
9   23   100    207/100   2.070000000000000000000000000
10   29   129    290/129   2.248062015503875968992248062
12   37   197    444/197   2.253807106598984771573604061
17   59   440    1003/440   2.279545454545454545454545455
25   97   1060    485/212   2.287735849056603773584905660
31   127   1720    3937/1720   2.288953488372093023255813954
35   149   2276    5215/2276   2.291300527240773286467486819
48   223   4661    10704/4661   2.296502896374168633340484875

I do not know a theorem related to $f(n)$. And I also do not know if there is an efficient method to calculate the sum of the first $n$ primes. It would be interesting to know at which point the function gets smaller than $2.01$. In OEIS , I found the sum of the first $10^{13}$ primes : It is $1,593,061,976,858,155,930,556,059,673$. The $10^{13}-th$ prime is $323,780,508,946,331$, so $f(10^{13})>2.03$

Finally, after finding the necessary data for $10^{20}$, I found the amazing result showing $f(10^{20})>2.02$

? print(n,"  ",t,"   ",s,"    ",n*t/s*1.0)
2220819602560918840  99999999999999999989       109778913483063648128485839045703833
541    2.022992879141165878001455078
$\endgroup$
3
  • $\begingroup$ See also : mathworld.wolfram.com/PrimeSums.html , which gives the approximation $\sum_{j=1}^n\ p_j\approx \frac{n^2\ ln(n)}{2}$, which together with the approximation $p_n\approx n\ ln(n)$ leads to $\large \frac{p_n}{\sum_{j=1}^n p_j}\approx \frac{2}{n}$ $\endgroup$
    – Peter
    Sep 1 '15 at 15:36
  • 1
    $\begingroup$ The error-term seems to be approximately $\frac{1}{ln(n)}$, so $f(n)\approx 2+\frac{1}{ln(n)}$. If this is true, $f(e^{100})\approx 2.01$ , so $f(2.7\times 10^{43}) \approx 2.01$ $\endgroup$
    – Peter
    Sep 1 '15 at 15:42
  • $\begingroup$ Interesting stuff. I was aware of a few theorems that relate to $f(n)$. See also the answer to an earlier question by me on this subject:math.stackexchange.com/questions/1405710/…. My question this time however is more about $g(n)$ and the graph it plots. Where does the pattern come from and does it indeed relate to $\tau$? $\endgroup$
    – Marijn
    Sep 1 '15 at 15:54
0
$\begingroup$

I got a similar looking graph when I plotted the difference between the error terms of $p_n \sim n\log(n)$ for $n$ and $n-1$. From this I got a better understanding of the graph, because here we can say $$f(n) = \left|n\log n - p_n - (n-1)\log(n-1)+p_{n-1}\right|$$ $$= \left|\log(n^n) - \log((n-1)^{n-1}) - g\right|$$ where $g$ is the prime gap between $p_n$ and $p_{n-1}$. We can then further simplify $$f(n)= \left|\log\left(\frac{n^n}{(n-1)^{n-1}}\right) - g\right|$$ and because $$\frac{n^n}{(n-1)^{n-1}} \sim en$$ we can say $$f(n) \approx \left|\log(en) - g\right|$$ It's now easy to see why this graph has the shape that it has. It's essentially a bunch of logarithmic functions that are shifted vertically by an amount of $g$. The fishnet-like appearance comes from the absolute brackets in the function, that reflect the negative values over the x-axis.

Now back to the original graph, which is a similar graph, but has a downward slope. If we look at Barry's observations on the function of the graph and take out the error terms $$\Delta(n) \approx \frac{2}{n} \left|{g\over\log n}-1\right|$$ we can then bring that down to $$\Delta(n) \approx \frac{2}{n\log n} \left|g-\log n \right|$$

Now we have a similar function to that of the other graph, where the first term is responsible for the downward slope, $\log n$ for the logarithmic functions and $g$ for the vertical shift of these functions. Again the absolute brackets make the fishnet-like appearance.

$\endgroup$
6
  • $\begingroup$ @BarryCipra I added the graph to the original question. $\endgroup$
    – Marijn
    Sep 11 '15 at 20:34
  • $\begingroup$ @BarryCipra I just added it, because of your comment :) $\endgroup$
    – Marijn
    Sep 11 '15 at 20:56
  • $\begingroup$ Oh, so that's how I managed to miss it! Well, thank you for adding it. $\endgroup$ Sep 11 '15 at 21:04
  • $\begingroup$ I'm still perplexed by the regularity of the spikes. What do you get if you simply graph the function $g(n)=g_n=p_n-p_{n-1}$? $\endgroup$ Sep 11 '15 at 21:08
  • $\begingroup$ @BarryCipra The regularity of the spikes comes from the regularity of the prime gaps. If you plot the prime gaps, you'll get a graph with horizontal lines on y=2, y=4, y=6, etc. $\endgroup$
    – Marijn
    Sep 11 '15 at 22:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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