# Are twin primes the only solution to this equation?

Let $$p,q_i, i \ge 1$$ be primes, $$m$$ a positive integer. The equation $$p.\prod_{i=1}^m(q_i-1)-(p-1).\prod_{i=1}^mq_i=2$$ for $$m=1$$ has all twin primes $$p,q_1=p+2$$ as solution.

Are there solutions for all $$m\ge2$$ ?

• The simplest heuristic suggests probably yes, but it seems unlikely to be possible to prove this. – Will Sawin May 10 '20 at 17:14
• I'm not sure what to expect. Without the primality condition, we have for each $m$ an equation of the same degree as the number of variables (namely $m+1$), so we expect some power of $\log N$ solutions up to $N$, unless there's a polynomial family. But primality costs a factor of $(\log N)^{m+1}$, suggesting a delicate balance. – Noam D. Elkies May 10 '20 at 17:59
• @NoamD.Elkies I think the leading term cancels, leaving us with a degree $m$ equation. This makes the probable situation more clear. – Will Sawin May 11 '20 at 1:52
• In the case $m=2$, you can take $q_1=p+2$ and $q_2=(p^2+p+2)/2$, so that your desired equation is just a polynomial identity. Standard conjectures then ensure that $p, q_1$ and $q_2$ are simultaneously prime, infinitely often – Mike Bennett May 11 '20 at 4:28

An exhaustive search up to $$1000$$ finds the solutions $$(p,q_1,q_2) = (3, 5, 7), (11, 13, 67), (59, 67, 487),$$ $$(191, 277, 613), (251, 463, 547), (347, 571, 883)$$ for $$m=2$$ and $$(p,q_1,q_2,q_3) = (3, 5, 7, 37), (3, 7, 7, 11), (23, 37, 107, 131), (83, 137, 283, 797)$$ for $$m=3$$.
Given an odd prime $$p$$ and integer $$m \geq 2$$, we can set $$q_1=p+2$$ and then, for each $$i$$ with $$2 \leq i \leq m$$, $$q_i = \frac{ 4+ (p-1) \prod_{j=1}^{i-1} q_j}{2}.$$ One can check that $$p \cdot \prod_{i=1}^m (q_i-1) - (p-1) \cdot \prod_{i=1}^m q_i =2,$$ and each $$q_i$$ is a polynomial in $$p$$, of degree $$2^{i-1}$$ (with coefficients in $$\mathbb{Z}[1/2^{i-1}]$$).
It is plausible that this construction should produce infinitely many values of $$p$$ for which $$p$$ and each $$q_i$$ are simultaneously prime. That being said, I may be missing some local obstruction. While this very likely leads to infinitely many examples for $$m \in \{ 2, 3, 4 \}$$, the smallest with $$m=4$$ being $$(p,q_1,q_2,q_3,q_4)=(3,5,7,37,1297),$$ examples with $$m=5$$ are rather thinner on the ground : the smallest is with $$p=512351711$$.