Are there infinitely many primes of this form?

The semiprime $87 = 3*29$ has a curious property: it's the fact that both

$87^2 + 29^2 + 3^2 = 8419$

and

$87^2 - 29^2 - 3^2 = 6719$

are prime numbers.

This intrigued me and led me to wonder if there are other semiprimes with the same property, and I found that

$21 = 3*7$ is another example, since both

$21^2 + 7^2 + 3^2= 499$

and

$21^2 - 7^2 - 3^2 = 383$ are prime numbers

So the following question arises: Are there infinitely many prime numbers $p$ and $q$, with $p \neq q$, such that both

$(pq)^2 + p^2 + q^2$

$(pq)^2 - p^2 - q^2$

are also primes?

Does this follows from some known theorem or conjecture?

• Does it help anyhow to consider a second degree equation $X^2-SX+P=0$ with $P=(a+b)(a-b)$ , $a=(pq)^{2}=S/2$, $b=p^2+q^2$ as well as the equation $Y^2-bY+a=0$? – Sylvain JULIEN Aug 13 '18 at 21:41
• I don't know if it helps, but by some basic algebra massaging you can show your two polynomials to be equal to $(pq-1)^2 + (p+q)^2 - 1$ and $(pq+1)^2 - (p+q)^2 -1$ respectively. The latter implies that the composite number $(p-1)(q-1)(p+1)(q+1)$ must be one more than a prime number, while the former (interestingly?) implies that the Gaussian composite $(p-i)(q-i)(p+i)(q+i)$ must be one more than a prime number (they are the same statement but with $p, q \mapsto ip, ip$). – Michael Cromer Aug 14 '18 at 2:18
• As usual with this kind of question about primes, I dare say that the answer is "probably, yes". – Eric Duminil Aug 14 '18 at 12:10
• – Kevin Casto Aug 14 '18 at 19:22

If both $p$ and $q$ are $\pm 1\mod 6$, then $(pq)^2 + p^2 + q^2$ is divisible by 3, so that there is only a possibility if one of the primes is 2 or 3. For $q = 2$ (and $p \ne 3$), $(pq)^2 + p^2 + q^2 = 5p^2 + 4$ also is divisible by 3. The question then becomes, are there infinitely many primes $p$ so that both $10p^2 + 9$ and $8p^2 - 9$ are prime?
Since it is not known if there is any polynomial of degree greater than 1 that produces infinitely many primes, let alone a pair of polynomials that in an infinite number of primes produce prime numbers, I guess it will be extremely hard to prove that there are infinitely many such pairs $(p, q = 3)$. It may be possible to prove that they don't, though I expect that would be hard as well.
• There are 26 such primes $p$ up to 10,000: 7, 29, 83, 181, 197, 337, 601, 631, 1303, 1847, 2029, 3023, 3109, 3359, 4591, 4649, 4831, 6397, 6791, 7489, 7559, 7573, 7951, 8609, 8933, and 9857 (provided you trust Maple and my programming skills). – Gerry Myerson Aug 13 '18 at 23:11
• The first $10,000$ such primes are given at the OEIS and a comment that the number is likely infinite. It should be possible to calculate how many such primes one would expect up to $N$ and use that data to see how well that seems to work. – Aaron Meyerowitz Aug 14 '18 at 6:18