between two semiprimes differing by 4 there are two primes

84 Views Asked by At

The two semiprimes 58 and 62 differ by four and have two primes 59 and 61 in the interval. Do you think this happens an endless number of times?

1

There are 1 best solutions below

0
On

Your problem is open because we don't even know if there are infinitely many twin primes.

However, a result of Landau is that the density of semiprimes is $\dfrac{\log x}{x \log \log x}$ while the density of primes is $\dfrac{\log x}x$. Therefore, a crude approximation of the density of the value required is $\dfrac{(\log x)^4}{x^4 (\log \log x)^2}$.


I've written a program to generate such pairs:

n = 10000000
primes = [True]*(n+1)
for p in range(2,n+1):
    if primes[p]:
        for j in range(p*p,n+1,p):
            primes[j] = False
semiprimes = [False]*(n+1)
for p in range(2,n+1):
    if primes[p]:
        for j in range(p,(n+1)//p):
            if primes[j]:
                semiprimes[p*j] = True

for p in range(2,n+1):
    if primes[p] and primes[p+2] and semiprimes[p-1] and semiprimes[p+3]:
        print("(%d,%d)"%(p-1,p+3),end=",")