Let $p_1, p_2, p_3, p_4, p_5, p_6$ be consecutive primes in ascending order.

For what $p_1$ do $$p_1x+p_2y=p_3$$$$p_4x+p_5y=p_6$$ produce integer solutions $(x, y)$?

Example: $p_1=2, p_2=3, p_3=5, p_4=7, p_5=11, p_6=13$ give $x=16, y=-9$ which are integers.

Solving gives $$x=\frac{p_3p_5-p_2p_6}{p_1p_5-p_2p_4}\quad\text{and}\quad y=\frac{p_3-p_1x}{p_2}=\frac{p_1p_6-p_3p_4}{p_1p_5-p_2p_4}$$ However, I do not know how to find when $(p_1p_5-p_2p_4)|(p_3p_5-p_2p_6)$.

By trial and error, I have found the following solutions: $$p_1=2\implies(x,y)=(16,-9)$$$$p_1=5\implies(x,y)=(-9,-8)$$$$p_1=19\implies(x,y)=(-13,12)$$$$p_1=59\implies(x,y)=(-3,4)$$ I believe there are infinitely many $p_1$ that work.

  • 1
    $\begingroup$ The question is equivalent to asking for which consecutive primes $p_1,\ldots ,p_6$ the ratio $\frac{p_3p_5-p_2p_6}{p_1p_5-p_2p_4}$ is an integer. The sequence of such initial primes $p_1$ starts with $(2,5,19,59,107,\ldots)$. It seems less frequent than, say, twin primes, but may be related to it. $\endgroup$ Jan 17, 2018 at 15:52
  • $\begingroup$ Is this a problem that you found somewhere that has a solution? Or your own question? Because I don't see any reason for a simple condition to exist other than the problem statement iself. $\endgroup$
    – orlp
    Jan 19, 2018 at 16:54
  • 1
    $\begingroup$ @orlp It is a problem I've made up. $\endgroup$
    – TheSimpliFire
    Jan 19, 2018 at 16:56
  • $\begingroup$ @DietrichBurde sorry, but for $107$ we get $p_1 = 107, p_2 = 109, p_3 = 113, p_4 = 127, p_5 = 131, p_6 = 137$ and thus the ratio you have is $(113\times131 - 109\times137)/(107\times131 - 109\times127) \approx -0.75$ which is certainly not an integer, so either the ratio condition is not equivalent or $107$ doens't belong in the list, right? $\endgroup$
    – RGS
    Jan 26, 2018 at 9:53
  • 1
    $\begingroup$ @RGS Yes, sorry a typo, it should be $151$. $\endgroup$ Jan 26, 2018 at 12:03

2 Answers 2


The infinitude of sextuplets of consecutive primes satisfying the given condition follows from some pretty strong well-known conjectures related to prime numbers. I will demonstrate it using Dickson's conjecture.

Consider the following six polynomials with integer coefficients: $$\begin{array}{c} p_1(n) := 210n + 59 \\ p_2(n) := 210n + 61 \\ p_3(n) := 210n + 67 \\ p_4(n) := 210n + 71 \\ p_5(n) := 210n + 73 \\ p_6(n) := 210n + 79 \\ \end{array}$$

Dickson's conjecture tells us that unless the product of these polynomials, $P(n)=\prod_i p_i(n)$ has a fixed divisor greater than $1$, there would be infinitely many integers $n$ for which all polynomials are simultaneously prime. The fixed divisor is a number which divides $P(n)$ for all integers $n$. This is easy to check in our case: $P(0)$ is a product of six primes and none of them divide $P(1)$. Thus, according to the conjecture, our polynomials should be simultaneously prime infinitely often.

It is also easy to see that $(x,y)=(-3,4)$ satisfies $$\begin{array}{c} p_1(n)x+p_2(n)y = p_3(n) \\ p_4(n)x+p_5(n)y = p_6(n) \\ \end{array}$$

The only remaining bit we need to prove is that these six primes would be consecutive, regardless of the value of $n$. This is not too difficult to see, though: All the numbers between $59$ and $79$ other than those used as summands in one of the six polynomials share a factor common with $210=2\times 3\times 5\times 7$ and thus cannot be primes.

In summary: It is very likely there are infinitely many primes satisfying the given condition. If one could prove there are only finitely many of them, it would disprove a few strong conjectures. On the other hand, infinitude of primes of this specific type does not imply any of those well-known conjectures; it is possible all of them are false, yet the number of primes of this specific kind would still be infinite.


Not a very mathematical approach to it, but I googled for a big list of primes (the first $10000$) and wrote a little script verifying for which values of $p_1$ we get that


is an integer. For those primes, I print $p_1$ and the solution $(x, y)$.

I found $133$ such ratios in the first $9995$ primes for a percentage of about

$$133 / 9995 \approx 1.13\%$$

The script can be found here and can be run online. The first solutions found, as well as the last are:

for p1 = 2 we have (x,y) = (16.0,-9.0)
for p1 = 5 we have (x,y) = (-9.0,8.0)
for p1 = 19 we have (x,y) = (-13.0,12.0)
for p1 = 59 we have (x,y) = (-3.0,4.0)
for p1 = 151 we have (x,y) = (-1.0,2.0)
for p1 = 487 we have (x,y) = (-2.0,3.0)
for p1 = 587 we have (x,y) = (-1.0,2.0)
for p1 = 739 we have (x,y) = (-2.0,3.0)
for p1 = 881 we have (x,y) = (-2.0,3.0)
for p1 = 1097 we have (x,y) = (-1.0,2.0)
for p1 = 104009 we have (x,y) = (-1.0,2.0)
  • $\begingroup$ I've just realised that on your list, with the exception of the four primes $p_1=2,5,19,31177$ we have that $$|y|=|x|+1$$ Interesting.... $\endgroup$
    – TheSimpliFire
    Feb 25, 2018 at 15:33
  • 1
    $\begingroup$ Might be tempted to ask whether there are infinitely many exceptions :) $\endgroup$
    – TheSimpliFire
    Feb 25, 2018 at 15:45
  • 1
    $\begingroup$ @TheSimpliFire indeed quite curious; not only the exceptions but the regularity with which $|x| + 1 = |y|$ $\endgroup$
    – RGS
    Feb 25, 2018 at 19:30
  • $\begingroup$ In particular, I see that $y$ is always positive whereas $x$ is always negative, so $$y=1-x$$ and this leads to the equation $$\frac{p_1-p_2}{p_2-p_3}=\frac{p_4-p_5}{p_5-p_6}$$ Very strange. $\endgroup$
    – TheSimpliFire
    Feb 28, 2018 at 14:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .