# Primes of form $x^2+x\pm k$

Perhaps someone could venture an explanation (maybe with some unproven assumptions) that makes heuristic sense of relation (1),(2) and examples below? Thanks for any insights.

Let $\pi(n) =$ number of primes $\leq n.$ Let $x_i <n,~~ i = 1,2,3,...$ such that $x_i^2+x_i \pm k$ is prime, in which $k \ll n$ is an odd integer. Let $\pi_p(n)$ be the number of such primes less than or equal to $n^2+n\pm k.$

$$(1)\hspace{10mm}\frac{\sum_{x_i|x_i^2+x_i\pm k~\in P}\ln x_i}{n}\approx \frac{\pi_p(n)} {\pi(n)}$$

Rearranging and applying the PNT simplifies (but weakens) the relation:

$$\pi_p(n)\cdot\ln n \sim \sum \ln x_i$$

But re-writing (1) this way doesn't seem to hurt the approximation (much):

$$(2)\hspace{10mm} \frac{\pi_p(n)}{\sum \ln x_i}\approx \frac{\pi(n)}{\sum_{p<n}\ln p}$$

And finally this--just inverting:

$$(3)\hspace{10mm} \frac{\sum \ln x_i}{\pi_p(n)}\approx \frac{\sum \ln p}{\pi(n)}\implies \frac{1}{m}\sum \ln x_i \approx \frac{1}{q}\sum \ln p,$$

a suggestion that maybe the average of $\ln x, x < n$ such that $x^2+x+k$ is prime, in which m is the number of these primes, is close to the average of $\ln p$ for $p < n$ in which q is $\pi(n).$

Two examples:

For (1). Primes of the form $x^2+x-15$ for $x = n \leq 500,000.$

$$\frac{\sum \ln x_i}{n} = 0.5157\approx \frac{\pi_p(n)}{\pi(n)} = 0.5165$$

For (2). Primes of form $x^2+x+1, x = n < 500,000.$

$$\frac{\pi_p(n)}{\sum \ln x_i} = 0.08320 \approx \frac{\pi(n)}{\sum \ln p} = 0.08315$$

-
 something with congruences to make sense of the differing probabilities? – Cris Stringfellow Feb 16 at 21:02 I upvoted the answer below because it showed work but it answers a question not asked. Hopefully my edited notation is finally right. Sum of logs of $x_i$ such that $x_i^2+x_i+k$ prime and sum of logs of primes $x_i^2+x_i+k$ differ by a factor of about 2. The former is what I am using. – daniel Feb 21 at 3:28

I have a heuristic verification and possibly an explanation for you using the modulus $210 = 2 \cdot 3 \cdot 5 \cdot 7$

So any residue $r$, $\bmod{~210}$ that has $\gcd(r,210) > 1$ will not be prime.

To investigate your equations I formed three lists, and counted the number of relevant residues that had $\gcd(r,210) = 1$, which I will detail below :

1. Form a list of residues of $x(x+1) + 1$
2. Form a list of residues of $x(x+1) + 3$
3. Form a list of residues of $x(x+1) - 15$

For example, to make the first list (in Python):

z = range(1,211)
zz1 = [(x*y+1)%210 for x in z for y in z if x-y == 1]
import fractions
zz1g = [fractions.gcd(210,x) for x in zz1]
print zz1g.count(1)


Yields: 99

In all cases the x were taken over the complete residue system $\bmod{~210}$, and the results were computed as the remainder when divided by $210$. The greatest common divisor with $210$ was then computed for each residue in each list and the occurrences of "1" were counted. The occurences are :

1. List 1, residues of form $x(x+1) + 1$, number of $\gcd$ of 1 = 99
2. List 2, residues of form $x(x+1) + 3$, number of $\gcd$ of 1 = 42
3. List 2, residues of form $x(x+1) - 15$, number of $\gcd$ of 1 = 42

So heuristic verification for your equations is displayed. The number of "candidates" for primes in the first equation form are nearly double that of the other two forms, which are similar. This reflects the relative ratios you reported.

As to further explanation, if the $\gcd$ is not 1 then the number can certainly not be prime. Since there are more "not $1$" greatest common divisors in either of forms $2$ or $3$ than their are in $1$, it follows that, since primes behave as if they are randomly distributed amongst candidate residues, more primes will occur from the form where the residues more often land on those which have no divisor in common with $210$.

In fact in this case the counts under $210$ strongly support the data you obtained from a half a million points. $210$ is just a single case, but the congruence argument will approach more closely the distributions you obtained, the larger the smoothness bound on the modulus.

Which suggests that the sum of $k$ with the product of two adjacent integers more often falls on a prime when $k$, perhaps, has no prime factors at all.

Hope this helps.

-
 ...when k, perhaps, has no prime factors at all. One is the only number that has no prime factors. – Fred Kline Feb 16 at 21:54 Exactly my meaning! – Cris Stringfellow Feb 16 at 22:01 So you want an explanation of why a scaled prime-counting function (for primes of a certain form between n and n(n+1) + k) is equal to log(n) times the number of primes in that region? [If you remove the denominator $n$ from your proportionality (with pi(n) approximation), then you get something like that]. The log function is additive for prime factors, maybe the sum of the log of the factors of n equals the average of the primes, but I don't know why. You use pi(n), and count a range of p_i, but you also slide n across the region less than 500k? Confused on Which n ou use to do your counts. – Cris Stringfellow Feb 17 at 5:35 You are correct. And by that approximation to pi(n), you can cancel $n$ from your approximations to give LHS being the sum of the logarithms of such primes, and RHS being the product of the logarithm of $n$ and the count of such primes. – Cris Stringfellow Feb 17 at 12:44 You seem to be talking about applying the PNT, which I did in the following line and which does not I think shed any light on the problem. – daniel Feb 17 at 13:16
show 1 more comment