# Asymptotics for primality of sum of three consecutive primes

We consider the sequence $R_n=p_n+p_{n+1}+p_{n+2}$, where $\{p_i\}$ is the prime number sequence, with $p_0=2$, $p_1=3$, $p_2=5$, etc..

The first few values of $R_n$ are: 10, 15, 23, 31, 41, 49, 59, 71, 83, 97, 109, 121, 131, 143, 159, 173, 187, 199, 211, 223, 235, 251, 269, 287, 301, 311, 319, 329, 349, 371, 395, 407, 425, 439, 457, ...

Now, we define $R(n)$ to be the number of prime numbers in the set $\{R_0, R_1 , \dots , R_n\}$.

What I have found (without justification) is that $R(n) \approx \frac{2n}{\ln (n)}$.

My lack of programming skills, however, prevents me from checking further numerical examples. I was wondering if anyone here had any ideas as to how to prove this assertion.

As a parting statement, I bring up a quote from Gauss, which I feel describes many conjectures regarding prime numbers: "I confess that Fermat's Theorem as an isolated proposition has very little interest for me, because I could easily lay down a multitude of such propositions, which one could neither prove nor dispose of."

• Is it called "recursion" when the sequence you're defining and the one you're using to define it are two different sequences? Aug 10 '11 at 1:52
• Im sorry, I dont understand what you are asking, Michael. First I have a recursion that defines an infinite set of numbers (R_n=sum of three consecutive primes). Then I consider the number of prime numbers in the set {R_0,...,R_n}. That is R(n). I hope that clears up your question
– Raj
Aug 10 '11 at 2:13
• @Raj: Your $R_n$ is not recursively defined, but defined directly in terms of the primes. You have no recursion in your message. Aug 10 '11 at 2:15
• ohhhh wow my bad, that was terrible wording... ughh well I think I'm still getting the main point of the question across
– Raj
Aug 10 '11 at 2:17
• I've taken the liberty of changing the title. Aug 10 '11 at 5:32

I believe proving (or disproving) such a statement is beyond current technology. On the other hand, by a crude heuristics the conjecture must be right: $R_1,\dots,R_n$ are $n$ odd numbers up to $\sim 3n\ln(n)$ which are rather evenly distributed in size and in residue classes. In this range the density of primes among odd numbers is $\sim 2/\ln(n)$, so $R(n)$ should be $\sim 2n/\ln(n)$.

EDIT: As Noam Elkies points out in a comment below, there should be a fine tuning similar to the twin prime constant.

• @Raj: My response contained vague statements like "rather evenly distributed". It is very far from a rigorous proof, and I would be surprised if anyone could give a rigorous proof. Aug 10 '11 at 2:24
• @Raj: Even the statement that your $R(n)$ tends to infinity seems hopeless to verify rigorously. Aug 10 '11 at 2:28
• The factor of $2$ isn't quite right, because even for prime $l>2$ the sum of three consecutive primes will diverge from equidistribution $\bmod l$ even if we believe that the residues of $p_n,p_{n+1},p_{n+2}\bmod l$ are independent. If I did this right, the probability that the sum of $3$ independent elements of $({\bf Z}/l{\bf Z})^*$ is nonzero $\mod l$ is $(l^2-3l+3)/(l-1)^2$, which exceeds $(l-1)/l$ by a factor $1 + 1/(l-1)^3$. So the constant should be $\prod_l \bigl(1+1/(l-1)^3\bigr) = 2.30096+$. This $15\%$ discrepancy should be experimentally detectable though it will take some care. Aug 10 '11 at 2:40
• @Will: That seems like an overvaluation of proofs to me. It can't be proved, but it seems highly likely that it does, and something interesting might be learned from what the limit seems to be quite independent of whether its existence can be proved. Aug 10 '11 at 6:43
• Joriki, it does depend on the problem. I put in a fair amount of effort on something by Kevin O'Bryant, maybe this one mathoverflow.net/questions/28462/… but maybe not, anyway Paul Monsky (I think in offsite email) pointed out that I was doing a limit with a known error term that resembled $$\frac{1}{\log \log n}$$ which meant, in effect, that the limit was undetectable by computer. As I am using C++ and each program takes effort, I felt I would sit this one out. Aug 10 '11 at 19:43

I verified Noam's calculation of the factor $\lambda=2.30096\ldots$ and Álvaro's computations, extended the latter and calculated the corresponding ratios:

$$\begin{array}{|c|c|c|c|c|} n & R(n) & 2n/\log n & \lambda n / \log n & R(n)\log n/n\\\\ \hline 10 & 7 & 9 & 10 & 1.61181\\\\ 100 & 44 & 43 & 50 & 2.02627\\\\ 1000 & 339 & 290 & 333 & 2.34173\\\\ 10000 & 2437 & 2171 & 2498 & 2.24456\\\\ 100000 & 18892 & 17372 & 19986 & 2.17502\\\\ 1000000 & 157183 & 144765 & 166549 & 2.17156\\\\ 10000000 & 1346797 & 1240841 & 1427564 & 2.17078\\\\ 30000000 & 3784831 & 3484987 & 4009410 & 2.17208\\\\ \end{array}$$

(The values in the third and fourth columns are rounded to the nearest integer, the values in the last column are rounded to 5 digits after the decimal point.)

I don't think we can deduce anything from the ratio in this form, however, since it shows convergence in the "random" fluctuations but not with respect to the asymptotic approximations made, e.g. dropping a term $\log\log n$, which at this stage is still comparable to $\log n$; a more detailed analysis will be required to test the independence hypothesis in this case.

[Update:] With reference to Noam's comments below, here are some data for the relative frequencies of the sum of three consecutive primes being divisible by the first four odd primes. These are averaged over samples of $400,000$ primes beginning at powers of ten, which are given in the first column; note that these refer to the numbers $x$ themselves, not the indices $n$ of the primes.

$$\begin{array}{|c|c|c|c|c|} \log_{10}x&3&5&7&11\\\\ \hline 8 &0.183&0.165&0.130&0.087\\\\ 9 &0.189&0.169&0.131&0.087\\\\ 10&0.195&0.170&0.133&0.087\\\\ 11&0.198&0.172&0.133&0.088\\\\ 12&0.203&0.173&0.133&0.088\\\\ 13&0.208&0.175&0.134&0.087\\\\ \hline \text{limit?}&0.250&0.188&0.139&0.090 \end{array}$$

I also looked at the joint distribution of the residues modulo $3$ for the three primes. There's a significant preference for avoiding repeated residues; for instance, at $x=10^9$, the repeating patterns $1,1,1$ and $2,2,2$ have relative frequencies around $0.095$, the alternating patterns $1,2,1$ and $2,1,2$ have relative frequencies around $0.150$, and the remaining mixed patterns have relative frequencies around $0.128$, which is almost completely explained by $1,1$ and $2,2$ having relative frequencies $0.445$ and $1,2$ and $2,1$ having relative frequencies $0.555$. I'm trying to work out a probabilistic model for these effects.

• See my comment on Álvaro Lozano-Robledo's computation. What happens when $n / \log n$ is replaced by the better estimate $\sum_{m=1}^n 1/\log(3p_m)$? Up to $n=10^5$ this made the observed constant much larger than $\lambda$ (about $2.8$). It seems that for the smallest odd primes $l$ it takes a while for the probability of $l \mid p_n + p_{n+1} + p_{n+2}$ to approach the expected value $(l^2-3l+3)/(l-1)^2$. Aug 10 '11 at 14:07
• @Noam: Yes, I made the same observations and was just doing some experiments on that -- the approach is quite slow; even at the end of the table the probability for $l=3$ is only about $0.2$ instead of the asymptotic $3/4$; this is due to repeated residues being significantly less likely than alternating residues, and this effect only decays slowly as the gaps between the primes become wider. Aug 10 '11 at 15:22
• @joriki: I guess you mean $0.2$ instead of $1/4$, not $3/4$. Also -- how close are $l=5$ and $l=7$, and does there seem to be significant dependence between $l=3$ and $l=5$? Presumably all these effects eventually disappear but it looks like it would require lots of computation to see the ratio converge to 2.30. Aug 10 '11 at 15:42
• @Noam: Yes, sorry, $1/4$. Regarding you other questions, see above. Yes, seeing the ratio converge to $2.30$ isn't feasible, I think; what might be feasible, though, is to model these effects well enough to support the conclusion that they eventually disappear. Aug 10 '11 at 17:45

For what it's worth, I calculated a bunch of values of $R(n)$ and the claimed densities. I also had into consideration Noam Elkies' possible correction to the factor of $2$ (i.e., use $\lambda n/\log(n)$ instead of $2n/\log(n)$, where $\lambda = \prod_l (1+1/(l-1)^3)\cong 2.30096\ldots$; see the comments in GH's answer). $$n \quad|\quad R(n) \quad | \quad 2n/\log(n) \quad | \quad (2.30096)n/\log(n)$$ $$10 \quad | \quad 7 \quad | \quad 8.685\ldots \quad | \quad 9.992\ldots$$ $$100 \quad | \quad 44 \quad | \quad 43.429\ldots \quad | \quad 49.964\ldots$$ $$1000 \quad | \quad 339 \quad | \quad 289.529\ldots \quad | \quad 333.098\ldots$$ $$10000 \quad | \quad 2437 \quad | \quad 2171.472\ldots\quad | \quad 2498.235\ldots$$ $$100000 \quad | \quad 18892 \quad | \quad 17371.779\ldots \quad | \quad 19985.884\ldots$$

• It may seem from this data that $2.30...$ is too large, but there are several small-number effects here. $n/\log n$ should be $\sum_{m=1}^n 1/\log(3 p_n)$, which is asymptotically the same but still smaller by $24\%$ at $n=10^5$ (6589 vs. 8686). This makes $R(10^5) = 18892$ seem too large by a substantial margin. It turns out that for small $n$ and the smallest odd primes $l$ it's much rarer than expected to have $l\mid p_n+p_{n+1}+p_{n+2}$; e.g. up to $10^5$ we get only $16401$ for $l=3$ and $15856$ for $l=5$, not the expected $25000$ and $18750$. Presumably this decays for large $n$... Aug 10 '11 at 13:58
• [correction: naturally what I meant is the sum over $m$ of $1/\log(3p_m)$, not $1/\log(3p_n)$.] Aug 10 '11 at 14:05