1 Introduction

Let D be a set of positive integers, called a distance set. The distance graph generated by D, denoted G(Z, D), is the graph with vertex set of the integers and an edge between any pair of vertices a and b if \(\lvert a-b\rvert \in D\). The chromatic number of distance graphs was first studied by Eggleton et al. [5] in 1985. The subject has been studied extensively since [1,2,3,4, 6, 9,10,11,12,13,14,15, 17,18,19,20, 22]. We denote the chromatic number of G(Z, D) by χ(D).

Let P denote the set of prime numbers. In [6] prime distance graphs were considered, that is, graphs with distance set D ⊆P. It was shown and easy to see that χ(P) = 4. Thus, given that D is a subset of P, χ(D) ∈{1, 2, 3, 4}, since D ⊆ D′ implies \(\chi (D) \leqslant \chi (D')\). The task considered is to classify a set of primes D according to its chromatic number. We say D is class i if χ(D) = i. Clearly the only set that is class 1 is the empty set, and every singleton is class 2. If \(|D| \geqslant 2\), then D is class 2 if and only if 2∉D. Also if 2 ∈ D but 3∉D, then D is class 3. A less trivial result is that {2, 3, p} is class 4 if p = 5, and class 3 otherwise (see [6]). In view of these results, the remaining problem is to classify prime sets D ⊃{2, 3} with \(|D| \geqslant 4\) into either class 3 or class 4.

It was shown in [6] that if D = {2, 3, p, p + 2} where p and p + 2 are twin primes, then D is class 4. Voigt and Walther [19] classified all prime sets with cardinality 4:

Theorem 1

Let D = {2, 3, p, q} be a set of primes with \(p \geqslant 7\) and q > p + 2. Then D is class 4 if and only if

$$\displaystyle \begin{aligned} (p{,}q) {\in} \{(11,19),(11,23),(11,37),(11,41),(17,29),(23,31),(23,41),(29,37)\}. \end{aligned}$$

Since Voigt’s paper in 1994, little progress has been made on the subject. It is interesting to note that, besides the potentially infinite family of distance sets containing twin primes, there are only finitely many class 4 sets of four primes. Thus it is natural to ask whether the same is true when D has five primes. A result from [6] shows that the set of potentially infinite families of class 4 distance sets will necessarily be more complicated than just those containing twin primes:

Theorem 2

The set {2, 3}∪{p, p + 8, 2p + 13} is class 4 whenever p, p + 8 and 2p + 13 are all primes.

In this article we begin to look at prime distance sets with 5 elements that do not contain twin primes nor any of the eight minimal class 4 sets of cardinality 4 obtained in Theorem 1. We call a prime distance set D minimal class 4, or just minimal, if D is class 4 but every proper subset is class 3 or less. Thus we are interested in distance sets which do not contain twin primes or any of the minimal class 4 sets in Theorem 1. We present the following main result:

Theorem 3

A prime set of the form D = {2, 3, 7, p, q} is class 3 if none of the following is true:

  1. 1.

    D contains a proper subset that is class 4.

  2. 2.

    The pair (p, q) is one of the following 31 pairs:

    $$\displaystyle \begin{aligned} &(19,31)& &(19,37)& &(19,41)& &(19,43)& &(19,47)& &(19,53)& &(19,67)& \\ &(19,73)& &(19,79)& &(19,83)& &(19,89)& &(19,109)& &(19,131)& &(19,151)& \\ &(19,157)& &(19,167)& &(19,193)& &( 29, 41)& &(29, 73)& &(29 ,109 )& &(31 , 43)& \\ &(37 , 59)& &( 41, 53)& &(47 ,59 )& &(61 ,73 )& &(67, 79)& &(71 ,83 )& &(89 , 101)& \\ &(97 , 109)& &( 139, 151)& &( 181, 193).& & & & & & & & & \end{aligned} $$
  3. 3.

    p ≡ 2311139, 2311163 (mod 4622310) and q = p + 8.

Moreover, the D sets with pairs (19, q) in 2 are all class 4.

In Sect. 3, we give a proof of Theorem 3, except the moreover part, which is presented in Sect. 4. In order to show that a distance set is class 3, we will make extensive use of the number theoretic function \(\kappa \colon \mathcal {P}(\boldsymbol {Z}^+) \to \boldsymbol {R}^+ \cup \{0\}\). For a real number x, let ||x|| denote the minimum distance from x to an integer, that is \(||x|| = \min \{\lceil x \rceil - x, x - \lfloor x \rfloor \}\). For any real t, denote by ||tD|| the smallest value ||td|| among all d ∈ D. The kappa value of D, denoted by κ(D), is the supremum of ||tD|| among all reals t. That is, \(\kappa (D) := \ \sup \{|| tD || \colon t \in \boldsymbol {R}^+ \cup \{0\} \}\). The fact that the kappa value of D is always a rational number with denominator dividing a sum of two elements in D gives an effective algorithm for computing κ(D) (see [8]).

The primary connection which we use in this paper is that (see [21])

$$\displaystyle \begin{aligned} \chi(D) \leqslant \left\lceil \frac{1}{\kappa(D)} \right\rceil. \end{aligned}$$

Thus, if \(\kappa (D) \geqslant 1/3\), then \(\chi (D) \leqslant 3\). In particular, since we assume {2, 3}⊂ D, if \(\kappa (D) \geqslant 1/3\), then D is class 3.

2 Three Lemmas on κ(D)

An alternative definition of κ(D) introduced by Gupta in [7] involves looking at the sets of “good times” for each element d ∈ D, that is, the times t ∈ [0, 1) such that ||td|| is greater than some desired value. For α ∈ [0, 1∕2] and an element d ∈ D, let \(I_d(\alpha ) = \{t \in [0,1) \colon ||td|| \geqslant \alpha \}\). Let I D(α) be the intersection over D of I d(α). If I D(α) is not empty, then \(\kappa (D) \geqslant \alpha \). Thus,

$$\displaystyle \begin{aligned} \kappa(D) = \sup\{\alpha\in [0,1/2] : I_D(\alpha) \neq \varnothing\}. \end{aligned}$$

Note that if κ(D) > α, then I D(α) is a union of intervals, and if κ(D) = α, then I D(α) is a union of singletons.

If I D(α) contains a nontrivial interval or, equivalently, if κ(D) > α, one might be interested in how large a number x must be to guarantee that the intersection of I D(α) and I x(α) is not empty, that is, \(\kappa (D \cup \{x\}) \geqslant \alpha \). Note that I x(α) is the union of x disjoint intervals with center (2n + 1)∕2x for n ∈{0, 1, …, x − 1} and length (1 − 2α)∕x, that is,

$$\displaystyle \begin{aligned} I_x(\alpha) = \bigcup\limits_{n=0}^{x-1}\bigg[\frac{n+\alpha}{x}, \frac{n+1-\alpha}{x}\bigg]. \end{aligned}$$

We call these x-intervals. The length of the space between any two consecutive x-intervals is 2αx. Now let [a, b] be a connected subset of I D(α). If the length of the space between each pair of consecutive intervals of I x(α) is less than the length of that subset, b − a, then it must be that one of the intervals of I x(α) hits the interval [a, b]. This can be summarized in the following lemma:

Lemma 1

Let [a, b] ⊆ I D(α) with a < b for some set D. If x is an integer, \(x \geqslant 2\alpha /(b-a)\), then \(I_D(\alpha ) \cap I_x(\alpha ) \neq \varnothing \). Consequently, \(\kappa (D \cup \{x\}) \geqslant \alpha \).

Considering two elements to be added to a set D, we describe an upper bound for the length of an interval of time in which the two sets I x(α) and I x+i(α) can be disjoint. If this bound is smaller than the length of a target interval contained in I D(α), we can similarly guarantee that the intersection of I D(α), I x(α) and I x+i(α) is not empty.

Lemma 2

Let \(1/4 \leqslant \alpha \leqslant 1/3\) and [a, b] ⊆ I D(α) with a < b. If x and i are integers with \(\frac {4\alpha - 1}{i} + \frac {2}{x} \leqslant b-a\), then \(I_D(\alpha ) \cap I_{x}(\alpha ) \cap I_{x+i}(\alpha ) \neq \varnothing \). Consequently, \(\kappa (D \cup \{x, x+i\}) \geqslant \alpha \).

Proof

Similar to Lemma 1, it is enough to show that \(I_{x} \cap I_{x+i} \cap I \neq \varnothing \) for any interval I ⊆ [0, 1] of length \(\frac {4\alpha - 1}{i} + \frac {2}{x}\).

We introduce some notation to make it easier to keep track of the different intervals. As noted above,

$$\displaystyle \begin{aligned} I_x(\alpha) = \bigcup\limits_{n=0}^{x-1}\bigg[\frac{n+\alpha}{x}, \frac{n+1-\alpha}{x}\bigg]. \end{aligned}$$

Fixing \(1/4 \leqslant \alpha \leqslant 1/3\), let \([\frac {n+\alpha }{x}, \frac {n+1-\alpha }{x}]\) be denoted by \(I_x^n\). Let \(L(I_x^n)\) and \(R(I_x^n)\) denote the left and the right endpoint of \(I_x^n\), respectively.

Assume \(i \geqslant x\). We first claim that every x-interval must intersect at least one (x + i)-interval. It suffices to show that the length of the gap between two consecutive (x + i)-intervals is less than the length of an x-interval, that is, \( \frac {2\alpha }{x+i} \leqslant \frac {1-2\alpha }{x} \). This is true with the assumptions \(\alpha \leqslant 1/3\) and \(x \leqslant i\).

Therefore, \(R(I_x^n) - L(I_x^{n-1}) = \frac {2-2\alpha }{x}\) is an upper bound on the length of an interval during which I x and I x+i are disjoint. By our assumption that \(\alpha \geqslant 1/4\), the result follows, as \(\frac {2-2\alpha }{x} < \frac {4\alpha - 1}{i} + \frac {2}{x} \leqslant b-a\).

Now assume i < x. Let \(I_x^{m}\) be any x-interval. If m = 0, then with the assumptions \(\alpha \leqslant 1/3\) and i < x, it can be shown that \(L(I_x^0) \leqslant R(I_{x+i}^0)\), and therefore there is some intersection between the two intervals.

If \(m \geqslant 1\), then let \(I_{x+i}^n\) be the closest (x + i)-interval to \(I_x^m\) such that \(R(I_{x+i}^{n}) \leqslant L(I_x^m)\) (that is, n is the largest such integer), and set \( L(I_x^m) - R(I_{x+i}^{n}) = \Delta \). Note that \(L(I_x^m) - L(I_x^{m-1}) = 1/x\). This implies that the separation between previous pairs of x and (x + i)-intervals decreases until the left point of an x-interval is less than the right point of an (x + i)-interval. More precisely,

$$\displaystyle \begin{aligned} L(I_x^{m-r}) - R(I_{x+i}^{n-r}) &=\bigg(L(I_x^{m}) - \frac{r}{x}\bigg) - \bigg(R(I_{x+i}^{n})-\frac{r}{x+i}\bigg)\\ &= L(I_x^m) - R(I_{x+i}^{n}) - \frac{r}{x} + \frac{r}{x+i}\\ &= \Delta - \frac{ir}{x(x+i)}. \end{aligned} $$

Fix \(j\geqslant 0\) so that \(\Delta - \frac {ij}{x(x+i)} \leqslant 0\) but \(\Delta - \frac {i(j-1)}{x(x+i)} > 0\). This implies that

$$\displaystyle \begin{aligned} R(I_{x+i}^{n-j}) - L(I_x^{m-j}) = \frac{ij}{x(x+i)} - \Delta \leqslant \frac{i}{x(x+i)}. \end{aligned}$$

With the assumptions that \(i\leqslant x\) and \(\alpha \leqslant 1/3\), it can be shown that

$$\displaystyle \begin{aligned} \frac{i}{x(x+i)} \leqslant \frac{1-2\alpha}{x} + \frac{1-2\alpha}{x+i}. \end{aligned} $$
(1)

The right-hand side of the above inequality is the sum of the lengths of an x-interval and an (x + i)-interval. Therefore, since \(R(I_{x+i}^{n-j}) - L(I_x^{m-j}) \leqslant \frac {1-2\alpha }{x} + \frac {1-2\alpha }{x+i}\), there must be some intersection between \(I_x^{m-j}\) and \(I_{x+i}^{n-j}\).

Having found an intersection between an x-interval and an (x + i)-interval at or before \(I_x^m\), we now move forward, looking at the right endpoint of the x-intervals. Notice,

$$\displaystyle \begin{aligned} L(I_{x+i}^{n+1+r}) - R(I_x^{m+r}) =&L(I_{x+i}^{n+1}) - R(I_x^{m}) - \frac{ir}{x(x+i)}\\ =&R(I_{x+i}^{n}) + \frac{2\alpha}{x+i} - R(I_x^{m}) - \frac{ir}{x(x+i)}\\ =&L(I_x^m) - \Delta + \frac{2\alpha}{x+i} - R(I_x^{m}) - \frac{ir}{x(x+i)}\\ =& \frac{2\alpha}{x+i}- \bigg( \frac{1-2\alpha}{x} + \frac{ir}{x(x+i)} + \Delta \bigg). \end{aligned} $$

Fix \(k\geqslant 0\) so that k is the smallest such that \(\frac {2\alpha }{x+i} \leqslant \frac {1-2\alpha }{x} + \frac {ik}{x(x+i)} + \Delta \), that is, the smallest with \(L(I_{x+i}^{n+1+k}) \leqslant R(I_x^{m+k})\). We now show that \(L_{x}^{m+k} \cap L_{x+i}^{n+k+1} \neq \varnothing \). Suppose k = 0, that is, \(L(I_{x+i}^{n+1}) \leqslant R(I_x^{m})\). By our choice of n as the largest such that \(R(I_{x+i}^{n}) \leqslant L(I_x^m)\), we have \(R(I_{x+i}^{n+1}) > L(I_x^m)\). This, together with the fact that \(L(I_{x+i}^{n+1}) \leqslant R(I_x^{m})\), implies \(L_{x}^{m} \cap L_{x+i}^{n+1} \neq \varnothing \).

Assume \(k \geqslant 1\). Then \(R(I_x^{m+k-1}) < L(I_{x+i}^{n+k})\). The only possibility that \(I_x^{m+k} \cap I_{x+i}^{n+1+k} = \varnothing \) is when the following inequality holds:

$$\displaystyle \begin{aligned} \frac{1-2\alpha}{x} + \frac{1-2\alpha}{x+i} &< R(I_x^{m+k}) - L(I_{x+i}^{n+1+k}) \\ &= R(I_x^{m+k-1}) - L(I_{x+i}^{n+k}) + \frac{i}{x(x+i)} \\ &< \frac{i}{x(x+i)}. \end{aligned} $$

This contradicts Eq. (1). Hence, \(I_x^{m+k} \cap I_{x+i}^{n+1+k} \neq \varnothing \)

In summary, given that \(j = \lceil \frac {x(x+i)\Delta }{i} \rceil \) and \(k = \lceil \frac {4\alpha x + 2\alpha i -x-i - x(x+i)\Delta }{i} \rceil \), we know that both \(I_x^{m-j}\) and \(I_x^{m+k}\) intersect an (x + i)-interval. Moreover, the length between these two intersections is bounded by the following:

$$\displaystyle \begin{aligned} R(I_x^{m+k}) - L(I_x^{m-j}) &= \frac{k+j}{x} + \frac{1-2\alpha}{x} \\ &\leqslant \frac{\frac{4\alpha x + 2\alpha i -x-i}{i} + 3 -2\alpha}{x} \\ &= \frac{4\alpha - 1}{i} + \frac{2}{x}. \end{aligned} $$

Therefore, the result follows. Note that if \(m+k \geqslant x\), then \(R(I_x^{m+k})\) is undefined. In this case the bound \(1 - L(I_x^{m-j})\) is smaller than the bound above. Similar arguments apply if m − j < 0. Note that \(1/4 \leqslant \alpha \leqslant 1/3\) implies that \(I_x \cap I_{x+i} \neq \varnothing \), since \(\kappa (\{x, x+i\}) \geqslant 1/3\). □

The final result of this section rationalizes the set of good times by expanding the unit circle to a circle of circumference q. This proposition will be useful because, fixing a rational point and an α, the proposition gives a finite list of residue classes of x modulo q such that the point will be in I x(α).

Lemma 3

Fix an integer x and an α ∈ [0, 1∕2], and let pq be a point in (0, 1). Then pq  I x(α) if and only if \(q\alpha \leqslant xp \pmod {q} \leqslant q(1 - \alpha )\).

Proof

To say that pq ∈ I x(α) is equivalent to saying that there exists an n ∈{0, 1, …, x − 1} such that \((n+\alpha )/x \leqslant p/q \leqslant (n+1-\alpha )/x\). Rearranging this inequality gives \( q\alpha \leqslant px - qn \leqslant q(1 - \alpha ). \)

3 Class 3 Prime Sets of the Form {2, 3, 7, p, q}

We apply the lemmas presented in the previous section to prove Theorem 3, except the moreover part, which will be shown in the next section. Recall, if \(\kappa (D) \geqslant 1/3\), then \(\chi (D) \leqslant 3\). Thus we fix α = 1∕3 in the following.

While the proof of Theorem 3 is conceptually simple, using nothing more sophisticated than modular arithmetic, there are many cases to check. Full verification requires a computer. For a more detailed discussion with all cases explained, see [16].

Let D = {2, 3, 7, x, x + i} where x and x + i are primes. First, Lemma 2 is applied to show that if both x and i are sufficiently large, then D must be class 3. As can be seen from Fig. 1, [4∕21, 2∕9] ⊆ I {2,3,7}(1∕3), and the length of this interval is 2∕63. The smallest gap i such that 1∕(3i) < 2∕63 is i = 11. Since the difference between any odd prime numbers is even, we only need to consider the cases of even integers \(i\geqslant 12\). For each \(i \geqslant 12\), there exists a bound M i such that, whenever \(p \geqslant M_i\) and \(q \geqslant p+i\), the set {2, 3, 7, p, q} is class 3.

Fig. 1
figure 1

The set I {2,3,7}(1∕3)

For example, fixing i = 12, we solve the following inequality from Lemma 2 for p: \( \frac {1}{3i} + \frac {2}{p} \leqslant \frac {2}{63}. \) Thus if \(p \geqslant 504\) and \(q \geqslant p + 12\), then, by Lemma 2, {2, 3, 7, p, q} will be class 3. Noting that as i increases the bound M i decreases, we can repeat this process. The bound M 52 = 79, and by computing the kappa value for all sets {2, 3, 7, p, p + i} where \(12 \leqslant i <52\) and \(79 \leqslant p \leqslant M_i\), we obtain the following proposition.

Proposition 1

If \(i \geqslant 12\) and \(p \geqslant 79\) and D = {2, 3, 7, p, p + i}, then D is class 3 for any pair of primes (p, p + i)∉{(89, 101), (97, 109), (139, 151), (181, 193)}.

The next step in the process is to remove the bound that p must be greater than 79. To accomplish this, for each set D = {2, 3, 7, p} for primes 7 < p < 79, we apply Lemma 1 to get a bound on q such that {2, 3, 7, p, q} is class 3 for every q exceeding the bound. Then we check whether \(\kappa (D) \geqslant 1/3\) for each of the small primes q which are below the bound. This work is summarized in Table 1 and justifies the following proposition. Note that the table includes twin primes and the known results from Theorem 1.

Table 1 Applying Lemma 1 to {2, 3, 7, p} for primes 7 < p < 79

Proposition 2

If \(i \geqslant 12\) and 7 < p < 79 and D = {2, 3, 7, p, p + i} does not contain a proper subset that is class 4, then D is class 3 for any pair of primes (p, p + i) not listed below:

$$\displaystyle \begin{aligned} &(19,31)& &(19,37)& &(19,41)& &(19,43)& &(19,47)& &(19,53)& &(19,67)& \\ &(19,73)& &(19,79)& &(19,83)& &(19,89)& &(19,109)& &(19,131)& &(19,151)& \\ &(19,157)& &(19,167)& &(19,193)& &( 29, 41)& &(29, 73)& &(29 ,109 )& &(31 , 43)& \\ &(37 , 59)& &(41, 53)& &(47 ,59 )& &(61 ,73 )& &( 67, 79)& &(71 ,83 ).& \end{aligned} $$

The fact that we switch from using Lemma 2 to Lemma 1 at p < 79 is arbitrary. Computationally, the hardest part of using Lemma 1 is finding the length of the longest interval in {2, 3, 7, p}, which is why Lemma 2 was used as long as it was.

Thus far we have shown that, as long as \(i \geqslant 12\), there are only finitely many minimal prime sets with κ({2, 3, 7, p, p + i}) < 1∕3. If i = 2, then p and p + 2 are twin primes and the set is class 4. The last step in the process is to show that, for i ∈{4, 6, 8, 10}, all prime sets of the form {2, 3, 7, p, p + i} that do not contain one of the known class 4 sets are class 3.

Consider the case when p and p + 4 are both primes. Note that this implies that p ≡ 1 (mod 6). We want to apply Lemma 3 to check if any rational points in the interval [4∕21, 2∕9] ⊂ I {2,3,7} are in both I p and I p+4. A natural place to start is by checking points with reduced denominator of 126, the least common multiple of 6, 21 and 9. The target interval [4∕21, 2∕9] = [24∕126, 28∕126], so we will apply Lemma 3 for the points \(\{n/126 : 24 \leqslant n \leqslant 28\}\). After removing the residue classes modulo 126 for which p≢1 (mod 6), we are left with Table 2.

Table 2 Rational points in I {2,3,7}I {p,p+4} (Round 1)

From Table 2 we see that, for each of the rows that is not highlighted, I {2,3,7,p,p+4} will contain the point in the rightmost column, implying that {2, 3, 7, p, p + 4} is class 3. To investigate the highlighted rows further, we increase the number of rational points to check by a factor of 5. The new denominator q = 630, and we must accordingly expand the undetermined list of residues to check. This gives Table 3.

Table 3 Rational points in I {2,3,7}I {p,p+4} (Round 2)

From Table 3 we see that if p ≡ 1 (mod 630), then p + 4 is not prime, if p ≡ 625 (mod 630), then p is not prime, and if p≢307, 319 (mod 630), then I {2,3,7,p,p+4} is not empty. Iterating again, this time just increasing by a factor of 2 gives Table 4, which has no highlighted rows. This means, no matter the residue class of a prime p modulo 1260, there exists some point in I {2,3,7,p,p+4}. Thus, this is the final table needed to finish the case when i = 4. Tables 2, 3, and 4 show that {2, 3, 7, p, p + 4} is class 3 for every pair of primes p and p + 4.

Table 4 Rational points in I {2,3,7}∩ I {p,p+4} (Round 3)

The cases when i ∈{6, 10} can be established similarly, but the case when i = 8 is much more difficult (see [16]). This is not surprising, as we have already have seen from Theorem 1 that {2, 3, 5, 13}, {2, 3, 11, 19}, {2, 3, 23, 31}, and {2, 3, 29, 37} are all class 4 sets. Using similar methods to those above, we were able to show that, if {2, 3, 7, p, p + 8} is a minimal class 4 set, it must be that p ≡ 2311139, 2311163 (mod 4622310). Note that 4622310 = 2 ⋅ 32 ⋅ 5 ⋅ 7 ⋅ 11 ⋅ 23 ⋅ 29. At this point it becomes computationally intractable to inspect the millions of rational points considered by Lemma 3. From this work we obtain the following proposition.

Proposition 3

If i < 12 and D = {2, 3, 7, p, p + i} does not contain a proper subset that is class 4, then D is class 3 for any pair of primes (p, p + i) where p≢2311139, 2311163 (mod 4622310) when i = 8.

We have shown how Lemma 2 generates Proposition 1, Lemma 1 generates Proposition 2, and Lemma 3 generates Proposition 3. Together Propositions 1 to 3 imply Theorem 3, except for the moreover part, which is the subject of the next section.

4 Class 4 Prime Sets of the Form {2, 3, 7, 19, p}

In this section, we prove the moreover part of Theorem 3. Precisely, we show that any 3-coloring of the distance graph generated by {2, 3, 7, 19} cannot be extended to a 3-coloring of the distance graph generated by {2, 3, 7, 19, p} for any p in the following set:

$$\displaystyle \begin{aligned} \{31,37,41,43,47,53,67,73,79,83,89,109,131,151,157,167,193\}. \end{aligned}$$

Our notation will follow that of Eggleton in [4]. Let c be a function c: Z →{0, 1, 2}. For a set D of positive integers, we say c is a D-consistent coloring if for every i, j ∈Z,

$$\displaystyle \begin{aligned} |i-j| \in D \implies c(i) \neq c(j). \end{aligned}$$

It follows from the definition that c is a 3-coloring for a set D if and only if c is a D′-consistent coloring for any D′⊆ D.

In the following we will consider a coloring c as a two-way infinite sequence, c := {c(i)}iZ. The structure of a coloring sequence c can be described by breaking it apart into the three constituent color classes. The k-color-class is defined as the set {i ∈Z : c(i) = k}. Let c be a {2, 3}-consistent coloring. Since each five consecutive integers in the distance graph generated by {2, 3} contains the 5-cycle {i + 1, i + 3, i + 5, i + 2, i + 4}, the difference between any two consecutive elements in a color class is at most 5, otherwise the five cycle must be properly colored with just two colors, which is impossible. In light of this we can consider each color class as a strictly increasing sequence of integers k := {k i}iZ where c(k i) = k for every i and k i < k i+1. The structure of a color class is primarily captured by the gaps or differences between consecutive elements in the ordered color class sequence. The gap sequence of a k-color-class k is defined as Δk(c) = d = {d i}iZ where d i = k i+1 − k i.

For any gap sequence d = Δk(c), let σ(d) be the set of all partial sums of consecutive terms in d. Equivalently,

$$\displaystyle \begin{aligned}\sigma(\boldsymbol{d}) = \{x: c(a) = c(x+a)=k \ \mbox{for some} \ a \in \boldsymbol{Z}\}. \end{aligned}$$

Given a coloring c, let σ(c) :=⋃iσ( Δi(c)). By definition, we obtain

Proposition 4

Let c be a function c: Z →{0, 1, 2}. Then c is a D-consistent coloring if and only if \(\sigma (\boldsymbol {c}) \cap D = \varnothing \).

Often the colorings considered are periodic. This is denoted by enclosing the repeated block in parenthesis. As an example of these definitions, consider the periodic coloring function c defined by

$$\displaystyle \begin{aligned} c(i) = \begin{cases}0 {\ if\ } i \equiv 0,1,5,6,10,11,16 \pmod{21}\\ 1 {\ if\ } i \equiv 2,7,8,12,13,17,18 \pmod{21}\\ 2 {\ if\ } i \equiv 3,4,9,14,15,19,20 \pmod{21}. \end{cases} \end{aligned}$$

The corresponding coloring sequence is c = (001220011200112201122), and the three color classes are:

$$\displaystyle \begin{aligned} \boldsymbol{0} &= \{ \dots 0,1,5,6,10,11,16,\dots \} \\ \boldsymbol{1} &= \{ \dots 2,7,8,12,13,17,18,\dots \} \\ \boldsymbol{2} &= \{ \dots 3,4,9,14,15,19,20,\dots \}. \end{aligned} $$

The three gap sequences are:

$$\displaystyle \begin{aligned} \Delta_0(c) &= (1,4,1,4,1,5,5) \\ \Delta_1(c) &= (5,1,4,1,4,1,5) \\ \Delta_2(c) &= (1,5,5,1,4,1,4). \end{aligned} $$

Since each of these gap sequences is a cyclic permutation of the others, the partial sums are the same for each:

$$\displaystyle \begin{aligned} \sigma(\Delta_0(\boldsymbol{c})) = \sigma(\boldsymbol{c}) = \{ x : x \equiv 0, \pm 1, \pm 4, \pm 5, \pm 6, \pm 9, \pm 10 \pmod{21} \}\end{aligned}$$

Since \(\{2,3,7,19\} \cap \sigma (\boldsymbol {c}) = \varnothing \), by Proposition 4, c is a {2, 3, 7, 19}-consistent 3-coloring.

4.1 Characterizing Gap Sequences

For either a color sequence or a gap sequence, we call any finite set of consecutive terms a block of the sequence. In this section we will investigate what blocks are possible for the gap sequences of a {2,3,7,19}-consistent coloring. Blocks of length l will be called l-blocks. In order to show that certain blocks are not possible, we will need to investigate how all three color classes interact. A gap sequence d almost completely determines a color sequence, as made precise by the following proposition from [4]:

Proposition 5

If d is a {2, 3}-consistent gap sequence, then d = Δ 0(c) where, up to a permutation of the labels, c is given by the following rule that assigns terms of the gap sequence to blocks of a color sequence:

$$\displaystyle \begin{aligned} \theta(d_i) = \begin{cases} 0 \quad &{if\ } d_i = 1 \\ 0112 \quad &{if\ } d_{i-1}>1 {\ and\ } d_i = 4 \\ 01z2 \quad &{if\ } d_{i-1}d_id_{i+1}=141 \\ 0122 \quad &{if\ } d_i = 4 {\ and\ } d_{i+1}>1 \\ 01122 \quad &{if\ } d_i = 5\\ \end{cases} \end{aligned} $$

where z ∈{1, 2} can be arbitrarily chosen for each 141 block in d.

The only possible gaps between consecutive elements of a color class are 1, 4 and 5. The fact that 2 or 3 cannot be gaps follows clearly from the definition, and the fact that no gap can be greater than 5 follows from existence of a 5-cycle in any block of five consecutive integers.

There are 9 possible 2-blocks of 1, 4, and 5: 11, 14, 15, 41, 44, 45, 51, 54, 55. Of these, 11 is impossible since it contains a partial sum of 2. In the following we prove that 44, 45, and 54 are also impossible.

Proposition 6

Any {2, 3, 7, 19}-consistent gap sequence cannot contain a 2-blocks of the form 44, 45, or 54.

Proof

We consider each case separately.

Case 1::

Let d be a {2, 3, 7, 19}-consistent gap sequence containing a 44 block. By Proposition 5, the corresponding color sequence must have the form c = …012201120…. Without loss of generality, let c 0 = 0, c 1 = 1, c 3 = 2, etc. We can now make the following chain of inferences:

$$\displaystyle \begin{aligned} (c_0 = 0 ) \wedge ( c_1 = 1) \wedge (c_2=2) &\implies (c_{-2} = 2) \wedge (c_{-1}=0) \\ (c_7 = 2 ) \wedge ( c_8 = 0) &\implies c_{10} = 1 \\ (c_{-2} = 2 ) \wedge ( c_{10} = 1) &\implies c_{17} = 0 \\ (c_{6} = 1 ) \wedge (c_{7} = 2 ) \wedge ( c_{17} = 0) &\implies (c_{9} = 0) \wedge (c_{14} = 1) \implies c_{16} = 2 \\ (c_{9} = 0 ) \wedge ( c_{5} = 1) &\implies c_{12} = 2 \\ (c_{12} = 2 ) \wedge ( c_{8} = 0) &\implies c_{15} = 1 \end{aligned} $$

The fact that c −1 = 0, c 15 = 1 and c 16 = 2 implies that c 18 cannot be properly colored, contradicting that d is a {2, 3, 7, 19}-consistent gap sequence.

Case 2::

Let d be a {2, 3, 7, 19}-consistent gap sequence containing the 2-block 45. By Proposition 5, we can assume the associated coloring sequence c contains the following block: c 0c 9 = 0122011220. Then

$$\displaystyle \begin{aligned} (c_0 = 0 ) \wedge ( c_1 = 1) &\implies c_{-2} = 2 \\ (c_{5} = 1) \wedge (c_{9} = 0) &\implies c_{12} = 2 \\ (c_{0} = 0) \wedge (c_{12} = 2) \wedge (c_{11} = 1) &\implies (c_{19} = 1) \wedge (c_{14} = 0) \implies c_{17}=2. \end{aligned} $$

This is a contradiction as c −2 = c 17.

Case 3::

Let d be a {2, 3, 7, 19}-consistent gap sequence containing the 2-block 54. By Proposition 5, we can assume the associated coloring sequence c contains the following block: c 0c 9 = 0112201120. Then

$$\displaystyle \begin{aligned} (c_{7} = 1) \wedge (c_{8} = 2) \wedge (c_{9} = 0) &\implies (c_{10} = 0) \wedge (c_{11} = 1) \implies c_{13} = 2 \\ (c_{9} = 0) \wedge (c_{13} = 2) \wedge (c_{1} = 1) &\implies (c_{16} = 1) \wedge (c_{20} = 0) \implies c_{23}=2. \end{aligned} $$

This is a contradiction, since c 4 = c 23.

From the five allowable 2-blocks, nine 3-blocks can be built: 141, 151, 155, 414, 415, 514, 515, 551, 555. Of these, 151 produces a partial sum of 7, and is therefore not possible. In the following we prove 515 is also not possible.

Proposition 7

Any {2, 3, 7, 19}-consistent gap sequence cannot contain the 3-block 515.

Proof

Let d be a {2, 3, 7, 19}-consistent gap sequence containing the 3-block 515. By Proposition 5, we can assume the associated coloring sequence c contains the following block: c 0c 11 = 011220011220. Then the fact that c 1 = c 8 = 1 contradicts the fact that c is a proper coloring. □

Finally three larger blocks are not allowed: 5555, 14141414 and 51415. The block 14141414 contains a partial sum of 19, and therefore cannot be in a {2, 3, 7, 19}-consistent gap sequence. In the following we prove that 5555 and 51415 are also impossible.

Proposition 8

Any {2, 3, 7, 19}-consistent gap sequence cannot contain the block 5555 nor 51415.

Proof

First, assume d is a {2, 3, 7, 19}-consistent gap sequence containing 5555. By Proposition 5, the associated color sequence contains the following block:

$$\displaystyle \begin{aligned} c_0 \dots c_{19} = 01122011220112201122. \end{aligned}$$

The fact that c 1 = 1 and c 13 = 2 implies c 20 = 0, but this together with the fact that c 4 = 2 and c 16 = 1 means that c 23 cannot be properly colored.

Next, assume d is a {2, 3, 7, 19}-consistent gap sequence containing the block 51415. By Proposition 5, the associated color sequence must contain the following block:

$$\displaystyle \begin{aligned} c_0 \dots c_{15} = 01122001x2001122 \end{aligned}$$

where c 8 = x ∈{1, 2} is not determined by the θ-rule. But the fact that c 1 = 1, c 6 = 0 and c 15 = 2 implies that c 8 cannot be properly colored. □

With the above classification of allowable blocks, we can characterize the possible {2, 3, 7, 19}-consistent gap sequences. The fact that 151, 45, 54 and 5555 are all impossible implies that any time a 5 occurs it must be part of a 1551 or a 15551 block. The fact that 11, 44 and 14141414 are all impossible implies that a 5 must occur in all gap sequences. The fact that 515 and 51415 are impossible implies that any {2, 3, 7, 19}-consistent gap sequence can be partitioned into a sequence consisting entirely of the following four blocks:

$$\displaystyle \begin{aligned} C_1 = 1414155, & & C_2 = 14141555, & & C_3 = 141414155, & & C_4 = 1414141555. & \end{aligned} $$
(2)

4.2 Characterizing Color Sequences

The monochromatic gap sequences are not sufficient to classify all sets {2, 3, 7, 19, p}, as 43∉σ(d) when d := (C 1C 2). As we are concerned with {2, 3, 7, 19}-consistent colorings we can strengthen Proposition 5 to the following:

Lemma 4

If d is a {2, 3, 7, 19}-consistent gap sequence, then d = Δ 0(c) where, up to a permutation of the labels, c is given by the following rule:

$$\displaystyle \begin{aligned} \eta(d_i) = \begin{cases} 0 \quad &{if\ } d_i = 1 \\ 0112 \quad &{if\ } d_{i-6} \cdots d_{i} = 5551414 {\ or\ } d_{i} \cdots d_{i+2} = 415 \\ 01z2 \quad &{if\ } d_{i-6} \cdots d_{i+6} = 1551414141551 \\ 0122 \quad &{if\ } d_{i-2} \cdots d_i = 514 {\ or\ } d_i \cdots d_{i+6}= 4141555 \\ 01122 \quad &{if\ } d_i = 5 \\ \end{cases} \end{aligned} $$

where z ∈{1, 2} can be chosen arbitrarily for each 1551414141551 block in d.

Proof

By Proposition 5, we need only prove the cases where d i = 4.

Case 1::

Suppose d i−6d i = 5551414. Then by Proposition 5

$$\displaystyle \begin{aligned} \theta (d_{i-6}\cdots d_{i}) = 011220112201122001z_12001z_22. \end{aligned}$$

The integer 19 spaces before z 2 is colored with a 2, so z 2 = 1 and η(d i) = 0112.

Case 2::

Suppose d id i+1d i+2 = 415. Then

$$\displaystyle \begin{aligned} \theta(d_{i} d_{i+1} d_{i+2}) = 01z2001122. \end{aligned}$$

The integer 7 spaces after z is colored with a 2, so z = 1 and η(d i) = 0112.

Case 3::

Suppose d i−2d i−1d i = 514. Then

$$\displaystyle \begin{aligned} \theta(d_{i-2}d_{i-1}d_i) = 01122001z2. \end{aligned}$$

The integer 7 spaces before z is colored with a 1, so z = 2 and η(d i) = 0122.

Case 4::

Suppose d id i+6 = 4141555. Then

$$\displaystyle \begin{aligned} \theta(d_i \cdots d_{i+6}) = 01z_12001z_220011220112201122. \end{aligned}$$

The integer 19 spaces after z 1 is colored with a 1, so z 1 = 2 and η(d i) = 0122.

Case 5::

The only block that has not been covered by the previous four cases is:

$$\displaystyle \begin{aligned} d_{i-6} \cdots d_{i+6} = 1551414141551, \end{aligned}$$

where the indeterminate color z in θ(d i) can still be either 1 or 2.

Our four gap sequence blocks can now be expanded to color sequence blocks. The strengthened η in Lemma 4 completely determines the color sequences from C 1, C 2 and C 4. The block C 3 can expand into two different color sequence blocks, depending on the choice for z.

$$\displaystyle \begin{aligned} A_1 &:= \eta(C_1) = 001220011200112201122 \\ A_2 &:= \eta(C_2) = 00122001120011220112201122 \\ A_3 &:= \eta(C_3) = 00122001120011200112201122 \quad ({with\ } z=1)\\ A_3^{\prime} &:= \eta(C_3) = 00122001220011200112201122 \quad ({with\ } z=2)\\ A_4 &:= \eta(C_4) = 0012200122001120011220112201122. \end{aligned} $$

It is more convenient to work with gap sequence triples rather than undifferentiated color sequences, so we unravel the above color sequences into the gap sequences for each color class.

$$\displaystyle \begin{aligned} \Delta_0(A_1) &= 1414155 & \Delta_1(A_1) &= 5141415 & \Delta_2(A_1) &= 1551414 \\ \Delta_0(A_2) &= 14141555 & \Delta_1(A_2) &= 514141415 & \Delta_2(A_2) &= 155141414 \\ \Delta_0(A_3) &= 141414155 & \Delta_1(A_3) &= 514141415 & \Delta_2(A_3) &= 15551414 \\ \Delta_0(A_3^{\prime}) &= 141414155 & \Delta_1(A_3^{\prime}) &= 55141415 & \Delta_2(A_3^{\prime}) &= 141551414 \\ \Delta_0(A_4) &= 1414141555 & \Delta_1(A_4) &= 5514141415 & \Delta_2(A_4) &= 14155141414. \end{aligned} $$

Thus any color sequence c can be partitioned into a sequence of blocks {X i} where \(X_i \in \{A_1, A_2, A_3, A_3^{\prime }, A_4\}\). But we need to put some restrictions on which blocks can follow one another. Considering Δ2(c), it is clear that A 2 cannot be followed by either \(A_3^{\prime }\) or A 4, since this would create a 14141414 block. Similarly A 4 cannot be followed by either \(A_3^{\prime }\) or A 4. Otherwise the blocks can be freely concatenated.

4.3 Guaranteed Partial Sums

Theorem 4

If p ∈{31, 37, 41}, then {2, 3, 7, 19, p} is class 4.

Proof

Let p ∈{31, 37, 41}, and assume that c is a {2, 3, 7, 19, p}-consistent 3-coloring. We know that d := Δ0(c) must contain at least one of the blocks C 1, C 2, C 3 or C 4. Let \(\lvert C_i\rvert \) denote the sum of all the terms in C i. That is, \(\lvert C_1\rvert = 21\), \(\lvert C_2\rvert =\lvert C_3\rvert =26\), and \(\lvert C_4\rvert =31\). By the structure of {2, 3, 7, 19}-consistent gap sequences (the blocks of (2)), we know that, regardless of what block precedes or follows C i, the sequence must have the form

$$\displaystyle \begin{aligned} \boldsymbol{d} = \cdots 55C_i14141 \cdots \end{aligned}$$

Thus we know σ(d) will contain the set \(\{\lvert C_i\rvert + n {:} n {\in } \{1,5,6,10,11,15,16,20,21\}\}\). Since

$$\displaystyle \begin{aligned} 31 &= \lvert C_1\rvert+10 = \lvert C_2\rvert+5\, = \lvert C_3\rvert+5\, = \lvert C_4\rvert, \\ 37 &= \lvert C_1\rvert+16 = \lvert C_2\rvert+11 = \lvert C_3\rvert+11 = \lvert C_4\rvert+6 ,\\ 41 &= \lvert C_1\rvert+20 = \lvert C_2\rvert+15 = \lvert C_3\rvert+15 = \lvert C_4\rvert +10, \end{aligned} $$

we know that {21, 37, 41}⊂ σ(d), and by Proposition 4 this contradicts the claim that c is a {2, 3, 7, 19, p}-consistent 3-coloring. □

Theorem 5

{2, 3, 7, 19, 43} is class 4.

Proof

Assume that c is a {2, 3, 7, 19, 43}-consistent 3-coloring.

Case 1::

Suppose c contains the block A 1. The fact that \(\lvert \Delta _2(A_1)\rvert = 21\) and, no matter what blocks follow, Δ2(c) has an initial sum of 22 implies that c has a partial sum of 43, contradicting the claim that c is a consistent coloring.

Case 2::

Suppose c contains A 2, A 3 or \(A_3^{\prime }\). Each of these blocks has sum 26. Thus the fact that Δ2(c) has an initial sum of 17 no matter what block follows implies c contains a partial sum of 43, a contradiction.

Case 3::

Suppose c contains A 4. Note that \(\lvert A_4\rvert = 31\). As the block after A 4 cannot be \(A_3^{\prime }\) or A 4, Δ1(c) must be of the form

$$\displaystyle \begin{aligned} \cdots 15 \Delta_1(A_4) 51 \cdots \end{aligned}$$

This gives a partial sum of 43, a contradiction.

In all three cases c cannot be a consistent 3-coloring, and the result follows. □

For the rest of the primes, the arguments only get more involved. We leave the verification that the partial sums of each color sequence of the prescribed form contain each prime listed at the beginning of this section to a computer (see [16]). To do so we construct an infinite tree colorings shown in Fig. 2. The tree is mutually recursively defined with the tree colorings’ shown in Fig. 3. Any path of the tree colorings, concatenating the color sequence blocks at each vertex, will produce a color sequence of the form \(\sum A_i\). Any path producing either a block A 2 or A 4 must be followed by a path producing either A 1, A 2 or A 3. This is represented by the pruned tree colorings’. Conversely, any one way infinite coloring sequence will be contained in a path of colorings. Thus it suffices to show that each path in colorings contains a partial sum of p for each prime p considered.

Fig. 2
figure 2

The tree colorings

Fig. 3
figure 3

The tree colorings’

This is done by the pair of functions pathsToLists and check. The function pathsToLists tree n creates a list of lists of length n, representing all the paths of length n in tree. Then the function check p is a Boolean function that, when applied to a list, returns True if the list contains a pair of equal elements with indices differing by p. This is equivalent to checking whether the coloring block represented by the list contains a partial sum of p. In this way, running the Haskell code in [16] verifies the following proposition.

Proposition 9

The set D = {2, 3, 7, 19, p} is class 4 for any p in the following set:

$$\displaystyle \begin{aligned}\{31,37,41,43,47,53,67,73,79,83,89,109,131,151,157,167,193\}.\end{aligned}$$

5 Conclusion

By establishing Theorem 3 we completely classify the prime sets {2, 3, 7, 19, p} and settle most of the more general family of the form {2, 3, 7, p, q}. Further we propose the following conjecture:

Conjecture 1

A prime set of the form D = {2, 3, 7, p, q} is minimal class 4 if and only if the pair (p, q) is one of the 31 pairs listed in Theorem 3 part 2.

In order to establish this conjecture, the 14 prime pairs not covered by Proposition 9 would need to be proven class 4. While the block method developed in Sect. 4 could be extended to more general distance sets, the results of that section are very tied to the fact that both 7 and 19 are in D. This makes it seem unlikely that the method would be tractable to the other 14 sets of the form {2, 3, 7, p, q}.

To confirm the conjecture, in addition the condition that p≢2311139, 2311163 (mod 4622310) when q = p + 8 would need to be removed. We believe that the most economical way to prove those D sets are indeed class 3 might be to find periodic 3-colorings for the associated distance graphs.