# Are there infinitely many primes $p$ such that $p-2$ and $p+2$ are composite?

Are there infinitely many primes $$p$$ such that $$p-2$$ and $$p+2$$ are composite?

If $$p\neq3$$ then either $$p+2$$ or $$p-2$$ is a multiple of three, but this does not settle the matter for both.

We know that there are infinitely many primes. But it is not known whether there are infinitely many twin primes, so something extra is needed here.

Any prime that is $8$ modulo $15$ works, and by Dirichlet's theorem on arithmetic progressions, there are infinitely many such primes.

• Very good. I wonder if there is a (very) elementary proof. The Q is equivalent to: There are infinitely many prime p which are not a member of a prime pair. Oct 6, 2016 at 1:41
• @user254665 : Well, Brun's theorem states that the sum of the reciprocals of the twin primes converges. That the zeta function has a pole at $1$ says the sum of the reciprocals of the primes diverges to infinity. Therefore, there are infinitely many such $p$. Now how elementary is Brun's theorem? Oct 6, 2016 at 2:26
• @user254665 Not in the same spirit as Starfall's answer. Elementary methods for Dirichlet work only for $p\equiv a\pmod b$ with $a^2\equiv1\pmod b$. With Starfall's idea we'd take $a\equiv\pm\,2$ modulo some primes dividing $b$, so for elementary methods to apply we need $2^2\equiv1\pmod p$, leaving only $p=3$. Feb 11, 2017 at 23:43
• @punctureddusk That result refers only to proofs via Euclid's argument for the infinitude of the primes. This proof by Erdos, is elementary and applies to $15n+8$, among other cases. May 5, 2019 at 14:15
• $p\equiv7\bmod{15}$ also works. Apr 28, 2023 at 0:31

Almost all primes have that property, as a result of the scarcity of twin primes.

Infiniteness of non-twin primes.

For reference purposes, from this paper of Maier ( see also this paper by Ford et al.) we have that for every $$d> 0$$ and $$k> 0$$ there exist consecutive primes $$p_{n}$$, $$p_{n+1}$$, $$\ldots$$, $$p_{n+k}$$ with $$p_{n+s}- p_{n+s-1} \ge d$$ for all $$1\le s \le k$$. For $$k=2$$ we conclude that we can have arbitrary large gaps on both sides of a prime number.

$$\bf{Added:}$$ this appears already on the site

$$\bf{Added:}$$ We can show using the method of @Ege Erdil that for every $$d>0$$ there exist consecutive primes $$p_{n-1}$$, $$p_{n}$$, $$p_{n}$$, with $$p_{n}-p_{n-1}$$, $$p_{n+1}-p_{n}\ge d$$. For $$d=3$$, and $$p = p_{n}$$ we get the answer to the question posted.

First, consider a prime $$p_{m}$$ with $$p_{m+1}- p_{m}\ge d$$. That is always possible (there are aribtrary large gaps). Now, consider $$N= \operatorname{lcm}(2,3, \ldots, p_{m-1})$$. Now, every number $$< p_{m+1}$$ and $$\ne p_m$$ has as prime factors among the $$2$$, $$3$$, $$\ldots$$, $$p_{m-1}$$. We conclude that the system of reduced residues $$\mod N$$ starts as $$1, p_{m}, p_{m+1}, \ldots$$

Now, with Dirichlet, find a prime $$p_n$$ such that $$p_{n} \equiv p_m \mod N$$ From the above we get

$$p_{n}-p_{n-1},p_{n+1} - p_{n} \ge \min(p_m -1, p_{m+1}-p_m)$$

$$\bf{Added:}$$ It may look that from the fact that in the sequence of reduced residues for some $$N$$ there are large consecutive gaps one can show the same for the sequence of primes, but I don't see how to prove it for longer chains. However, from the existence of large chains of gaps in the sequence of primes we can find some sequence of reduced residues with large consecutive gaps, like above. Note that $$\phi(N)/N$$ can be arbitrarily small, so there may be large gaps on the average. The problem for reduced residues seems interesting.