betaFeedback

WorksMathematics

Sharp linear bounds for the EKG sequence

Abstract

We prove that the EKG sequence satisfies 13n/28≤a(n)≤12n/713n/28\le a(n)\le12n/7 for every n≥1n\ge1, with equality only at n=28n=28 and n=7n=7, respectively. Discovered by Jonathan Ayres, the sequence starts with 1,21,2 and repeatedly takes the least unused positive integer sharing a factor greater than 11 with its predecessor. This proves the sharp linear bounds conjectured by Lagarias, Rains and Sloane, who established coarse bounds at every index. Hofman and Pilipczuk proved the limits 1/21/2, 3/23/2 and 11 of a(n)/na(n)/n on primes, their triples and the other terms, and Haver made these estimates explicit and formalized them in Lean. Our earlier second-order asymptotic also builds on Haver's work. We sharpen Haver's self-improving early-even bound with a shorter prime window and effective large-sieve constants, and control odd terms so that the analytic range meets a finite computation. Lean checks the deduction from the definition, conditional on computed premises; independent programs check those premises, and their correspondence with the formal statements was checked by reading the code. This work has not yet been reviewed by experts. The proofs, the Lean formalization, the programs and the text were produced by AI models, working under the author's direction.

2020 Mathematics Subject Classification: Primary 11B83; Secondary 11N36, 68V15.

Introduction

The EKG sequence, discovered by Jonathan Ayres and studied by Lagarias, Rains and Sloane [13 Introduction], is A064413 in the OEIS [19]. Write Ut={a(1),…,a(t)}U_t = \{a(1), \ldots, a(t)\}. The sequence is defined by

a(1)=1,a(2)=2,a(n)=min⁡{m≥1:m∉Un−1, gcd⁡(m,a(n−1))>1}(n≥3),(1)a(1) = 1,\quad a(2) = 2,\quad a(n) = \min\{m \ge1 : m \notin U_{n-1},\ \gcd(m, a(n - 1)) > 1\}\quad(n \ge3), \tag*{(1)}

so it begins 1, 2, 4, 6, 3, 9, 12, 8, 10, 5, 15, 18, 14, 7, 21, 24, 16, 20, 22, 11, . . . . It is a permutation of the positive integers [13 Theorem 1] (Theorem 2.5 in the journal version). Its graph has three visible lines (Figure 1): most terms satisfy a(n)≈na(n) \approx n, while each odd prime pp is immediately preceded by 2p2p and followed by 3p3p, and when a(n)=pa(n) = p we have p≈n/2p \approx n/2 (and a(n+1)=3p≈3n/2a(n + 1) = 3p \approx3n/2). Lagarias, Rains and Sloane proved n/260≤a(n)≤14nn/260 \le a(n) \le14n and conjectured sharp linear bounds [13 Conjecture 3, end of §4] (Conjecture 4.3 in the journal version):

Figure 1. Left: a(n)/na(n)/n for n≤60n \le60, with the bounds 12/712/7 (top) and 13/2813/28 (bottom) of Theorem 1, attained at n=7n = 7 and n=28n = 28. Right: the largest and smallest values of a(n)/na(n)/n over each block 2k≤n<2k+12^k \le n < 2^{k+1}, n≤106n \le10^6, approaching 3/23/2 and 1/21/2 (dotted). Drawn from the computed sequence.

The sequence a(n)a(n) satisfies a(n)≥1328na(n) \ge\frac{13}{28}n, with equality if and only if n=28n = 28, and a(n)≤127na(n) \le\frac{12}{7}n, with equality if and only if n=7n = 7.

Theorem 1. For every integer n≥1n \ge1,

1328n≤a(n)≤127n.\frac{13}{28}n \le a(n) \le\frac{12}{7}n.

The lower bound is an equality only for n=28n = 28 (where a(28)=13a(28) = 13) and the upper bound only for n=7n = 7 (where a(7)=12a(7) = 12).

Prior work. Lagarias, Rains and Sloane give the pointer rule as an alternative definition [13 eq. (2)] and prove the coarse bounds above [13 Theorems 2–3]. Their Conjecture 2 states a(n)∼n(1+1/(3log⁡n))a(n) \sim n(1 + 1/(3 \log n)) when a(n)a(n) is neither pp nor 3p3p for a prime pp, a(n)∼(n/2)(1+1/(3log⁡n))a(n) \sim(n/2)(1 + 1/(3 \log n)) when a(n)=pa(n) = p, and a(n)∼(3n/2)(1+1/(3log⁡n))a(n) \sim(3n/2)(1 + 1/(3 \log n)) when a(n)=3pa(n) = 3p [13 Conjecture 2]. Hofman and Pilipczuk [11 Theorems 4.3, 4.17, Lemma 4.5 and Corollary 4.12] proved the full pattern 2p,p,3p2p, p, 3p for odd primes, bounded the crossings of a level by composite terms, and proved the leading limits a(n)/n→1/2a(n)/n \to1/2, 3/23/2 and 11 for prime, triple-prime and remaining terms, respectively. Haver made these arguments explicit and formalized them in Lean [10 (F2), Theorems 5, 8, 11 and Corollary 12(b)], reducing the pattern’s computed base to the primes p≤43p \le43, bounding the number of used even numbers above the least missing even number, the spread of the terms above it, and the unused composites below it, and relating the index to that even number by a counting identity. The author [9] then obtained a second-order asymptotic, n+n/(3log⁡n)+o(n/log⁡n)n + n/(3 \log n) + o(n/\log n), for a smoothed version of the sequence (each odd prime pp and 3p3p replaced by 2p2p), on Haver’s Lean foundation. The present proof uses Haver’s Lean definition of the sequence and Haver’s estimates, and the author’s exact form of the counting identity, as proved Lean theorems.

Haver already closes a self-improving early-even inequality and obtains its leading asymptotic constant by Brun–Titchmarsh [10 Lemma 4, Theorem 5, Remark 6(b)]. The hardest step is to make that inequality close at a frontier reached by a finite computation; Haver’s explicit bound is too weak at that frontier. We shorten the prime window from 4K+34K + 3 to 3K+23K + 2 integers, where KK counts the used even numbers above the least missing even number; effective large-sieve constants and odd-term control make the analytic range meet a finite computation.

The proof uses Lean and computations of a finite prefix and an interval-arithmetic certificate. § 9 gives the formal statement and its relation to the theorem; Appendix B describes the computed premises and their checks.

The result is computer-assisted.

Notation and known facts

All logarithms are natural. The notation below separates the three kinds of terms and the errors in the counting identity. The terms frontier, early evens and tick value follow Haver [10 §§1–2]. A state t≥1t \ge1 is the moment after a(1),…,a(t)a(1), \ldots, a(t) have been placed. For a state tt define:

  • E(t)E(t), the frontier: the least positive even integer not in UtU_t. It is nondecreasing in tt, and every even number below E(t)E(t) is used.

  • K(t)K(t), the number of early evens: even w∈Utw \in U_t with w>E(t)w > E(t).

  • Bq(t)B_q(t), the least multiple of qq not in UtU_t.

  • A tick value is 3p3p with pp an odd prime. T(t)T(t) is the largest element of UtU_t that is not a tick value, and O(t)O(t) is the number of odd w∈Utw \in U_t with w>E(t)w > E(t) that are not tick values.

  • H(t)H(t), the number of holes: composite h<E(t)h < E(t) with h∉Uth \notin U_t.

  • A(x)=π(x)−2π(x/2)+π(x/3)A(x) = \pi(x) - 2\pi(x/2) + \pi(x/3), where π\pi counts primes.

For example, after a(1..7)=1,2,4,6,3,9,12a(1..7) = 1, 2, 4, 6, 3, 9, 12 we have E(7)=8E(7) = 8, the early even 12, so K(7)=1K(7) = 1, and O(7)=0O(7) = 0 since 9 is a tick value.

We use the following facts; each is a Lean theorem in the foundation (§ 9). The parenthesized labels refer to the statements recalled here.

(F1) Pointer rule [13 eq. (2)]. a(n)=min⁡{Bq(n−1):q prime, q∣a(n−1)}a(n) = \min\{B_q(n - 1) : q\ \text{prime},\ q \mid a(n - 1)\} for n≥3n \ge3.

(F2) Prime pattern. For each odd prime pp there is an index NpN_p with a(Np)=2p=E(Np−1)a(N_p) = 2p = E(N_p - 1), a(Np+1)=pa(N_p + 1) = p and a(Np+2)=3pa(N_p + 2) = 3p; the value 3p3p occurs only at Np+2N_p + 2, and indices NpN_p of distinct primes differ by at least 4. See [11 Theorem 4.3] and [10 (F2)]; the finite checks and detailed attributions are in Appendix B.§ 1.

(F3) Crossings [11 Lemma 4.5], [10]. For a level x>2x > 2, at most π(x)\pi(\sqrt{x}) indices nn have a(n)a(n) composite and a(n)<x≤a(n+1)a(n) < x \le a(n + 1).

(L7) [10 Lemma 7] B3(t)≤E(t)+6K(t)+6B_3(t) \le E(t) + 6K(t) + 6 for t≥9t \ge9.

(SP) Span [10 Theorem 8]. With k=K(t)+1k = K(t) + 1 and e=E(t)e = E(t), T(t)−e≤2k2+2kk2+eT(t) - e \le2k^2 + 2k\sqrt{k^2 + e} for t≥9t \ge9.

(EE) Our variant of [10 Lemma 4], from its proof. Call i<ti < t a prime up at state tt if a(i)a(i) is prime and a(i)<E(t)≤a(i+1)a(i) < E(t) \le a(i+1); it is paired if a(i+1)a(i+1) is odd and a(i+2)<E(t)a(i+2) < E(t), and unpaired otherwise. Then K(t)≤π(E(t))+1+#{unpaired prime ups at t}K(t) \le\pi(\sqrt{E(t)}) + 1 + \#\{\text{unpaired prime ups at }t\}. Pairing uses only terms already placed at state tt, so i+2≤ti+2 \le t is required; a prime up with i+1=ti+1=t is unpaired.

(CL) Counting identity [10 Corollary 12(b)], in the exact form of [9]. For t≥9t \ge9 and e=E(t)e = E(t),

e−t=A(e)+H(t)−K(t)−O(t)+c(t),1≤c(t)≤5.e-t = A(e) + H(t) - K(t) - O(t) + c(t), \qquad1 \le c(t) \le5.

Here c(t)c(t) is the bounded correction in (CL). A crossing of a level is a step from one side of that level to the other; upward and downward refer to its direction. The inequalities in (F3) fix the convention at an endpoint.

Write π−(x)≤π(x)≤π+(x)\pi^{-}(x) \le\pi(x) \le\pi^{+}(x) for the explicit prime-counting bounds in Appendix A; π(x)\pi(x) counts primes up to xx. The following two forms of the large sieve are proved in Lean.

(BT) Primes in short intervals. For real x>0x > 0, y≥1y \ge1 and integers Q≥6Q \ge6,

π(x+y)−π(x)≤y+Q2log⁡(Q+1)+1.07+π(Q).\pi(x+y)-\pi(x) \le\frac{y+Q^{2}}{\log(Q+1)+1.07}+\pi(Q).

We use the additive inequality of Montgomery and Vaughan [17 Theorem 1] and their arithmetic lower bound [17, (2.7)}, which they credit to Montgomery [16]. OpenAI’s formalization [18] already supplies the arithmetic large sieve with Farey separation 1/Q21/Q^{2}. For (BT) we use separation 1/(Q2−1)1/(Q^{2}-1) to obtain the numerator y+Q2y+Q^{2}. We also prove G(Q)=∑d≤Qμ2(d)/φ(d)>log⁡(Q+1)+1.07G(Q)=\sum_{d\le Q}\mu^{2}(d)/\varphi(d)>\log(Q+1)+1.07, the form in the proof of [17 Lemma 7], whose printed statement is G(z)≥log⁡z+1.07G(z)\ge\log z+1.07 for real z≥6z\ge6.

(LS) Arithmetic large sieve [16, 17]. For an integer Q≥2Q \ge2, a set of integers in an interval of NN consecutive integers that avoids one residue class modulo every prime p≤Qp \le Q has at most (N+Q2)/log⁡Q(N+Q^{2})/\log Q elements.

Strategy

The three kinds of terms behave differently, and each is located through the frontier. If a(n)=pa(n)=p is an odd prime then n=Np+1n=N_{p}+1 and E(n−2)=2pE(n-2)=2p by (F2); if a(n)=3pa(n)=3p then n=Np+2n=N_{p}+2 and E(n−3)=2pE(n-3)=2p; every other term either lies above the frontier E(n−1)E(n-1), and then at most T(n)T(n), or fills a hole below it, and holes lie close to the frontier. The counting identity (CL) relates the index tt to e=E(t)e=E(t): A(e)≈e/(3log⁡e)A(e)\approx e/(3\log e) is small, and if KK, OO and HH are small compared to ee, then t≈et\approx e and the three kinds of terms give a(n)/na(n)/n near 1/21/2, 3/23/2 and 11.

Everything therefore rests on explicit upper bounds for KK, OO and HH at every state, uniformly in a range of ee. Haver bounds each by a multiple of π(e)\pi(\sqrt e) (times further factors), so the bounds are relatively small only when ee is astronomically large. We split the indices into three ranges:

  1. n≤L=1.6⋅1010n \le L = 1.6\cdot10^{10}: computed (Section B.1);

  1. L<n<10203L<n<10^{203}: a bootstrap bound K(t)≤M(E(t))K(t)\le M(E(t)) for a step function MM, certified with E(L−2)≥e0=1.3328⋅1010E(L-2)\ge e_{0}=1.3328\cdot10^{10} and on every interval of a cover of [e0,10205)[e_{0},10^{205}) (§ 4–§ 6);

  1. n≥10156n \ge10^{156}: Haver’s bounds alone (§ 7).

The ranges overlap, so every nn is covered. Range 2 requires the bound on KK already at e=1.3328⋅1010e = 1.3328 \cdot10^{10}.

The early-even bound. Theorem 1 needs sharp constants at every nn: the lower line a(n)/n→1/2a(n)/n \to1/2 sits only 1/281/28 above 13/2813/28. With Haver’s bound K≤12π(E)+720K \le12\pi(\sqrt{E}) + 720 [10 Theorem 5] the argument closes only for very large nn; we use it that way for n≥10156n \ge10^{156} (Lemma 8), far beyond any computation. The quantitative improvement uses a shorter prime window (Lemma 2, Corollary 3): the primes responsible for the excess of KK lie among the 3K+23K + 2 integers just below E/2E/2, so K≤π(E)+2+#{primes among 3K+2 consecutive integers}K \le\pi(\sqrt{E}) + 2 + \#\{\text{primes among }3K + 2\text{ consecutive integers}\}, and a Brun–Titchmarsh bound from the large sieve turns this into K≤(1+o(1))π(E)K \le(1 + o(1))\pi(\sqrt{E}). The bound is proved by induction over the moments of the sequence, so it needs no prior bound on KK: at each moment the earlier ones already satisfy it, and an explicit inequality, checked on intervals of EE, carries it to the next. At E=1.3328⋅1010E = 1.3328 \cdot10^{10} the certified bound is 28,017, against 131,628 from Haver’s bound. A second large-sieve bound controls the odd terms above EE (Lemma 5). With these, explicit estimates close once E≥1.3328⋅1010E \ge1.3328 \cdot10^{10}; the computed first 1.6⋅10101.6 \cdot10^{10} terms reach that point (with EE above 1.41⋅10101.41 \cdot10^{10} by n=1.393⋅1010n = 1.393 \cdot10^{10}) and settle every smaller nn.

Early evens

We bound the primes responsible for early evens. For a state tt let K<(t)=max⁡{K(s):1≤s<t}K^{<}(t) = \max\{K(s) : 1 \le s < t\}, with K<(1)=0K^{<}(1) = 0.

Lemma 2. Let tt be a state and e=E(t)e = E(t). Every unpaired prime up ii at state tt has p=a(i)p = a(i) prime with 2p<e<2p+6K<(t)+62p < e < 2p + 6K^{<}(t) + 6.

Proof. The prime 2 is never a prime up: a(2)=2a(2) = 2, a(3)=4a(3) = 4, and E(t)≥6E(t) \ge6 for t≥3t \ge3. So pp is odd, and by (F2) a(i−1)=2p=E(i−2)a(i - 1) = 2p = E(i - 2) and a(i+1)=3pa(i + 1) = 3p. Since 2p∈Ut2p \in U_t, 2p≠e2p \ne e, and EE is nondecreasing, so 2p<e2p < e. Unpairedness forces every multiple of 3 below ee to be used by the state k=i+1k = i + 1 when k<tk < t (otherwise a(i+2)≤B3(k)<ea(i + 2) \le B_3(k) < e by (F1), since 3∣a(k)3 \mid a(k)); in particular 3∤e3 \nmid e, as ee is still unused at tt. Each multiple ww of 6 with 2p<w<e2p < w < e is then used by state kk, is none of 2p2p, pp, 3p3p, and so was already used at state i−2i - 2, where E(i−2)=2p<wE(i - 2) = 2p < w: it is an early even at state i−2<ti - 2 < t. Since 6∤e6 \nmid e there are more than (e−2p)/6−1(e - 2p)/6 - 1 such ww, so (e−2p)/6−1<K(i−2)≤K<(t)(e - 2p)/6 - 1 < K(i - 2) \le K^{<}(t). In the remaining case i+1=ti + 1 = t we have Ut=Ui−2∪{2p,p,3p}U_t = U_{i-2} \cup\{2p, p, 3p\}, so every even ww with 2p<w<e2p < w < e lies in Ui−2U_{i-2} and is an early even at state i−2i - 2; hence (e−2p)/2−1≤K<(t)(e - 2p)/2 - 1 \le K^{<}(t), which is stronger. ∎

Corollary 3 (Bootstrap). Let e0<E1e_0 < E_1, let MM be a nondecreasing function on the integers, and let BT(y)BT(y) bound the number of primes in every block of yy consecutive integers. Suppose that K(s)≤M(E(s))K(s) \le M(E(s)) at every state ss with E(s)<e0E(s) < e_0, and that

π(e)+2+BT(3M(e)+2)≤M(e)(2)\pi(\sqrt{e}) + 2 + BT(3M(e) + 2) \le M(e) \tag*{(2)}

for every even ee with e0≤e<E1e_0 \le e < E_1. Then K(t)≤M(E(t))K(t) \le M(E(t)) at every state tt with E(t)<E1E(t) < E_1.

Proof. Strong induction on tt. The states t≤9t \le9 have K(t)≤1K(t) \le1 by direct computation of the first terms, and (2) gives M(e)≥2M(e) \ge2, so they satisfy the claim. Let e=E(t)≥e0e = E(t) \ge e_0. Every $s < t

has E(s)≤eE(s) \le e, so by induction and monotonicity K(t)≤M(e)K(t) \le M(e). By Lemma 2 the primes pp of the unpaired prime ups at tt satisfy e/2−3M(e)−3<p<e/2e/2 - 3M(e) - 3 < p < e/2, so they lie among 3M(e)+23M(e) + 2 consecutive integers, and they are distinct because the sequence does not repeat values. Thus (EE) gives K(t)≤π(e)+1+BT⁡(3M(e)+2)≤M(e)K(t) \le\pi(\sqrt{e}) + 1 + \operatorname{BT}(3M(e) + 2) \le M(e) by (2).

The function BT⁡(y)\operatorname{BT}(y) bounds primes in an interval of length yy; the label (BT) refers to the displayed sieve estimate. With (BT), BT⁡(y)≤(y+Q2)/(log⁡(Q+1)+1.07)+π(Q)\operatorname{BT}(y) \le(y + Q^2)/(\log(Q + 1) + 1.07) + \pi(Q) for any integer Q≥6Q \ge6. For y=3M+2y = 3M + 2 and QQ near y/log⁡y\sqrt{y}/\log y this is about 2y/log⁡y≈6M/log⁡M2y/\log y \approx6M/\log M, so (2) holds once MM is a little larger than π(e)/(1−6/log⁡M)\pi(\sqrt{e})/(1 - 6/\log M). This is (1+o(1))π(e)(1 + o(1))\pi(\sqrt{e}) as e→∞e \to\infty, and about 2.6π(e)2.6\pi(\sqrt{e}) at e=1.3328⋅1010e = 1.3328 \cdot10^{10}. Haver’s argument counted the same primes through their residues modulo 210, which bounds them only by a fixed fraction of the window; this is where Haver’s factor 12 comes from.

Holes and odd terms above the frontier

The next two lemmas bound HH and OO in terms of a bound MM on KK. Lemma 4 is Haver’s hole bound [10 Theorem 11] with an arbitrary nondecreasing bound MM in place of Haver’s explicit one, and with the hypothesis needed only at earlier states.

Lemma 4 (Holes). Let MM be nondecreasing with K(s)≤M(E(s))K(s) \le M(E(s)) for every state s<ts < t, and e=E(t)e = E(t). Every hole h≥15h \ge15 at state tt satisfies e−h≤2spf⁡(h)(π(h)+M(h)+4)e - h \le2\operatorname{spf}(h)(\pi(\sqrt{h}) + M(h) + 4), where spf⁡(h)\operatorname{spf}(h) is the least prime factor of hh, and H(t)≤π(e)(π(e)+M(e)+5)H(t) \le\pi(\sqrt{e})(\pi(\sqrt{e}) + M(e) + 5).

Proof. A hole hh is odd; put s=spf⁡(h)s = \operatorname{spf}(h) and let t1t_1 be the first state with E(t1)>hE(t_1) > h. Every multiple ww of 2s2s in (h,e)(h,e) is used. If it was placed after t1t_1 then the next term is at most Bs<hB_s < h by (F1), a down-crossing of the level hh; at most K(t1−1)≤M(h)K(t_1 - 1) \le M(h) of them were placed before t1t_1. Up-crossings come from composite bases (at most π(h)\pi(\sqrt{h}) by (F3)) or from primes pp with a(n)=3pa(n) = 3p, each of which is matched with its own down-crossing 2p→p2p \to p. As ups and downs alternate, the number of multiples of 2s2s in (h,e)(h,e) is at most π(h)+M(h)+3\pi(\sqrt{h}) + M(h) + 3, which gives the first bound. Summing over the primes s≤es \le\sqrt{e} the number of odd multiples of ss in the resulting window gives the second.

Lemma 5 (Odd terms above the frontier). Let t≥10t \ge10 be a state, e=E(t)e = E(t), K′=max⁡s≤tK(s)K' = \max_{s \le t} K(s), and let Y≥6K′+7Y \ge6K' + 7 be an integer. Put X=e+Y+12X = e + Y + \frac{1}{2} and R=(Y+12)/(2(K(t)+1))R = (Y + \frac{1}{2})/(2(K(t) + 1)). Then

O(t)≤⌈Y2⌉+π(X)+Z,O(t) \le\left\lceil\frac{Y}{2}\right\rceil+ \pi(\sqrt{X}) + Z,

where ZZ is the number of integers mm with X<m≤T(t)X < m \le T(t) all of whose prime factors exceed RR.

Proof. At most ⌈Y/2⌉\lceil Y/2\rceil odd values lie in (e,X)(e,X). Let v=a(i)>Xv = a(i) > X be another value counted by O(t)O(t), and c=a(i−1)c = a(i - 1) its predecessor. If cc were even, (F1) with q=2q = 2 would give v≤E(i−1)≤ev \le E(i - 1) \le e; if cc were 1 or an odd prime, vv would be 2 or a tick value (F2); if cc were a tick value, (F1) with q=3q = 3 and (L7) would give v≤e+6K′+6<Xv \le e + 6K' + 6 < X. So cc is an odd composite, not a tick value, with c≤T(t)c \le T(t). For each prime r∣cr \mid c, Br(i−1)≥vB_r(i - 1) \ge v by (F1), so the multiples of 2r2r in (e,v)(e,v) are all early evens at tt: there are at least (v−e)/(2r)−1(v - e)/(2r) - 1 of them, whence r>Rr > R. If c<Xc < X the step c→vc \to v crosses the level XX upward, which happens at most π(X)\pi(\sqrt{X}) times by (F3); otherwise cc is counted by ZZ, and v↦cv \mapsto c is injective.

The proof uses (F3) at the real level XX. For the cover we weaken its crossing term to π(e+Y+1)\pi(\sqrt{e+Y+1}), as in the formal lemma, which counts the odd non-tick excess above the integer e+Ye+Y. The remaining odd values contribute at most ⌈Y/2⌉\lceil Y/2\rceil.

By (SP) the numbers counted by ZZ lie in an interval of at most S−YS-Y integers, S=2k2+2kk2+eS=2k^2+2k\sqrt{k^2+e}, and they avoid the residue 00 modulo every prime p≤Rp\le R; so (LS) gives Z≤(S−Y+Q2)/log⁡QZ\le(S-Y+Q^2)/\log Q for every integer 3≤Q≤R3\le Q\le R.

The middle range

We now combine the lemmas using a finite table of parameters on adjacent intervals of values of E(t)E(t). The inequalities in each row bound the terms of the counting identity. Put e0=13,328,000,000e_0=13{,}328{,}000{,}000, Kfin=329K_{\mathrm{fin}}=329, E1=10205E_1=10^{205} and L=16,000,000,000L=16{,}000{,}000{,}000.

Definition 6. A row is a tuple of nonnegative integers (ea,eb,M,Y,Q,hc,bq)(e_a,e_b,M,Y,Q,h_c,b_q). With k=M+1k=M+1,

S=2k2+2kk2+eb,pU=π+(eb),S=2k^2+2k\sqrt{k^2+e_b},\qquad p_U=\pi^+(\sqrt{e_b}),
O∗=⌊(Y+1)/2⌋+π+(eb+Y+1)+(S−Y+Q2)/log⁡Q,O^*=\lfloor(Y+1)/2\rfloor+\pi^+(\sqrt{e_b+Y+1})+(S-Y+Q^2)/\log Q,
H∗=pU(pU+M+5),H^*=p_U(p_U+M+5),
Amin⁡=π−(ea)−2π+(eb/2)+π−(ea/3),A_{\min}=\pi^-(e_a)-2\pi^+(e_b/2)+\pi^-(e_a/3),
Amax⁡=π+(eb)−2π−(ea/2)+π+(eb/3),A_{\max}=\pi^+(e_b)-2\pi^-(e_a/2)+\pi^+(e_b/3),

the row is valid if ea<ebe_a<e_b, 6M+7≤Y<S6M+7\le Y<S, 3≤Q≤(Y+12)/(2(M+1))3\le Q\le(Y+\frac{1}{2})/(2(M+1)), hc≥15h_c\ge15, bq≥6b_q\ge6 and

pU+2+3M+2+bq2log⁡(bq+1)+1.07+π+(bq)≤Mp_U+2+\frac{3M+2+b_q^2}{\log(b_q+1)+1.07}+\pi^+(b_q)\le M

(B)

hc+2hc(π+(hc)+M+4)<eah_c+2\sqrt{h_c}\bigl(\pi^+(\sqrt{h_c})+M+4\bigr)<e_a

(Hc)

M+O∗+1−Amin⁡<ea/13M+O^*+1-A_{\min}<e_a/13

(P)

Amax⁡+H∗+2<ea/8A_{\max}+H^*+2<e_a/8

(Tk)

7S+12(Amax⁡+H∗+4)<5ea7S+12(A_{\max}+H^*+4)<5e_a

(Od)

13(eb−Amin⁡+M+O∗)<28hc.13(e_b-A_{\min}+M+O^*)<28h_c.

(Ol)

A cover is a list of valid rows with eae_a of the first row equal to e0e_0, M≥KfinM\ge K_{\mathrm{fin}} in the first row, each eae_a equal to the previous ebe_b, MM nondecreasing, and last eb≥E1e_b\ge E_1.

In words: (B) is the bootstrap inequality (2) on the row; (Hc) puts every hole above hch_c; (P) and (Tk) bound the index tt above and below in terms of E(t)E(t), which handles primes and tick values; (Od) bounds the terms above the frontier, and (Ol) the holes filled, for the remaining terms. O∗O^*, H∗H^*, Amin⁡A_{\min} and Amax⁡A_{\max} bound OO, HH and AA on the row.

The published interval certificate (in the Zenodo archive linked below the title) gives a cover with first row M=28,017M=28{,}017. Appendix B.§ 3 displays its first row and describes the finite checks. The condition (P) in Definition 6 is an index inequality; Appendix A uses the same label for the prime-counting bounds.

Theorem 7. Assume a cover exists, the bounds of Theorem 1 for n≤Ln\le L with its equality cases, E(L−2)≥e0E(L-2)\ge e_0, and K(s)≤KfinK(s)\le K_{\mathrm{fin}} at every state ss with E(s)<e0E(s)<e_0. Then every nn with L<n<10203L<n<10^{203} has 13n<28a(n)13n<28a(n) and 7a(n)<12n7a(n)<12n. Moreover every state tt with e0≤E(t)<E1e_0\le E(t)<E_1 has t+2<14E(t)/13t+2<14E(t)/13.

Proof. Let M(x)=KfinM(x)=K_{\mathrm{fin}} for x<e0x<e_0 and M(x)=MjM(x)=M_j on the jj-th row’s interval [ea,eb)[e_a,e_b); it is nondecreasing. Condition (B) and (BT) with Q=bqQ=b_q give (2) on every row, so Corollary 3 yields K(t)≤M(E(t))K(t)\le M(E(t)) at every state with E(t)<E1E(t)<E_1.

Fix a state tt with e=E(t)e=E(t) in the interval of row jj. Then K(s)≤MjK(s)\le M_j for all s≤ts\le t. Lemma 4 gives H(t)≤H∗H(t)\le H^*, and every hole hh exceeds hch_c, because a hole h≤hch\le h_c would give e≤hc+2hc(π(hc)+Mj+4)<ea≤ee\le h_c+2\sqrt{h_c}(\pi(\sqrt{h_c})+M_j+4)<e_a\le e by (Hc) (using spf⁡(h)≤h\operatorname{spf}(h)\le\sqrt{h}). (SP) gives T(t)−e≤ST(t)-e\le S, and Lemma 5 with YY and the sieve bound after it give O(t)≤O∗O(t)\le O^*. Since Amin⁡≤A(e)≤Amax⁡A_{\min}\le A(e)\le A_{\max}, the identity (CL) yields

e−Amax⁡−H∗−5≤t≤e−Amin⁡+M+O∗−1.(3)e-A_{\max}-H^*-5\le t\le e-A_{\min}+M+O^*-1. \tag*{(3)}

By (P), t+2<e+ea/13≤14e/13t+2<e+e_a/13\le14e/13; by (Tk), t+3>7e/8t+3>7e/8.

Now let L<n<10203L<n<10^{203}. Then E(n)≤2n+2<E1E(n)\le2n+2<E_1, and every state t≥n−3t\ge n-3 has E(t)≥E(L−2)≥e0E(t)\ge E(L-2)\ge e_0, so the bounds above apply at t∈[n−3,n]t\in[n-3,n].

  • If a(n)=pa(n)=p is an odd prime, take t=n−2t=n-2, so e=2pe=2p. Then 13n=13(t+2)<14e=28p13n=13(t+2)<14e=28p, and n>7e/8−1n>7e/8-1 gives 12n>7p12n>7p.

  • If a(n)=3pa(n)=3p, take t=n−3t=n-3, so e=2pe=2p. Then 12n>12⋅7e/8=21p12n>12\cdot7e/8=21p, and 13n<14e+13<28⋅3p13n<14e+13<28\cdot3p.

  • Otherwise v=a(n)v=a(n) is even or an odd composite that is not a tick value; take t=n−1t=n-1. If v>ev>e then v≤T(n)≤e+Sv\le T(n)\le e+S, and (3) with (Od) gives 7v<12n7v<12n, while 13n<14e<28v13n<14e<28v. If v=ev=e both bounds follow from 7e/8<n+27e/8<n+2 and 13n<14e13n<14e. If v<ev<e, then vv is a hole at state tt, so v>hcv>h_c and (Ol) with (3) gives 28v>13n28v>13n, while 7v<7e<12n7v<7e<12n.

The far range

For very large nn Haver’s explicit bounds suffice, without a cover. Ordinary terms here mean even terms and odd composite terms other than the values 3p3p. The hypothesis below is used only while E(t)<E1E(t)<E_1, to obtain the stated lower bound on E(t)E(t) at large indices. Once E(t)≥E1E(t)\ge E_1 that lower bound is automatic. The subsequent estimates use Haver’s bounds; this is the sense of range 3 in the strategy. In the proof below, (P) means the prime-counting bounds of Appendix A. The numerical estimates follow by substituting those bounds into Haver’s sequence estimates; the accompanying Lean proof contains their derivation (in the Zenodo archive linked below the title).

Lemma 8. Suppose every state tt with e0≤E(t)<E1e_0\le E(t)<E_1 has t+2<14E(t)/13t+2<14E(t)/13, and E(L−2)≥e0E(L-2)\ge e_0. Then every n≥10156n\ge10^{156} has 13n<28a(n)13n<28a(n) and 7a(n)<12n7a(n)<12n.

Proof. At the states t≥n−3t\ge n-3 the hypothesis forces E(t)>9⋅10155E(t)>9\cdot10^{155}. From (P) one derives 0.921x/log⁡x≤π(x)≤1.045x/log⁡x0.921x/\log x\le\pi(x)\le1.045x/\log x for x≥1076x\ge10^{76}. Inserted into Haver’s bounds K≤12π(e)+720K\le12\pi(\sqrt e)+720 [10 Theorem 5], (SP), Haver’s hole bound and (CL) (with O≤(T−e)/2+1O\le(T-e)/2+1), this gives 0.997e<t0.997e<t, t+3<1.0766et+3<1.0766e and T(t)<1.153eT(t)<1.153e at each such state tt, with e=E(t)e=E(t), and shows that every hole exceeds e/1.1543e/1.1543. Then the three cases of the proof of Theorem 7 give a(n)/na(n)/n between 1/(1.1543⋅1.0766)>0.81/(1.1543\cdot1.0766)>0.8 and 1.153/0.997<12/71.153/0.997<12/7 for ordinary terms, and between 1/(2⋅1.0766)1/(2\cdot1.0766) and 3/(2⋅0.997)3/(2\cdot0.997) for primes and tick values; the binding comparison is 13⋅2⋅1.0766<2813\cdot2\cdot1.0766<28.

Proof of the main theorem

Proof of Theorem 1. The computed range supplies the three finite premises of Theorem 7, and the interval certificate supplies its cover. That theorem proves the strict bounds for L<n<10203L < n < 10^{203} and the inequality on states required by Lemma 8. The lemma proves the strict bounds for n≥10156n \ge10^{156}. These ranges overlap and cover every n>Ln > L; the computed bounds for n≤Ln \le L supply both equality cases.

Formal verification

Lean 4 [8, 15] checks the theorem

EKG3.conj3_of_computations :
FiniteFa → FiniteFbP3 → FiniteFcP3 → CertifiedCoverP3 → Conj3Statement.

Its conclusion says: for every i≥0i \ge0, with n=i+1n = i+1 and a(n)=EKG.actualA ia(n) = \mathrm{EKG.actualA}\ i, 13n≤28a(n)13n \le28a(n), 7a(n)≤12n7a(n) \le12n, 13n=28a(n)⟺n=2813n = 28a(n) \Longleftrightarrow n = 28 and 7a(n)=12n⟺n=77a(n) = 12n \Longleftrightarrow n = 7. These integer forms are equivalent to the rational ones in Theorem 1. The sequence in the formal statement is Haver’s greedy sequence with initial terms 1, 2, injectivity, a shared prime factor and minimality as in (1); its indexing starts at zero. Reading the implication from left to right, the four premises are respectively (Fa), (Fb), (Fc) of Appendix B.§ 1, and the cover of Definition 6. They assert the finite bounds, the lower bound on E(L−2)E(L-2), the bound on KK before e0e_0, and the existence of that cover, all about the sequence with no free parameters. The last term, Conj3Statement, is the conclusion just spelled out. Lean checks the analytic inputs and the deduction from these premises; the premises themselves and the correspondence of the programs with those definitions are checked outside Lean. The formal proof uses only Lean’s standard axioms. Appendix B describes the computational checks and dependencies. Reproduction commands and implementation details are in the supplementary checking notes.

Related work. Haver’s work on the Yellowstone permutation, concurrent [1, 2] and later [3, 4, 5], concerns a different greedy permutation; nothing from those papers is used here. Other nearby visiting rules include Applegate, Havermann, Selcoe, Shevelev, Sloane and Zumkeller’s Yellowstone permutation [21], Basistha and Ionaşcu’s coprime permutation [22], and Na’s real-multiplier process [23]. Nothing from these works is used here.

Prime-counting bounds

These formulas specify the prime-counting bounds used in the interval conditions and in the far range. The analytic inputs are explicit and all are proved in Lean. Put c=1.03883c = 1.03883, α=0.92129\alpha= 0.92129 and, for x≥256x \ge256, F(x)=xlog⁡x(1+1log⁡x+2log⁡2x+24log⁡3x)F(x) = \frac{x}{\log x}\left(1 + \frac{1}{\log x} + \frac{2}{\log^{2} x} + \frac{24}{\log^{3} x}\right), R(x)=cx+clog⁡2xx1/3log⁡xR(x) = c\sqrt{x} + \frac{c}{\log^{2}x}x^{1/3}\log x.

(P) Prime counting. For x≥256x \ge256, π−(x)≤π(x)≤π+(x)\pi^{-}(x) \le\pi(x) \le\pi^{+}(x), where π+(x)=cF(x)+J\pi^{+}(x) = cF(x) + J with J=π(256)−θ(256)/log⁡256+c(256/log⁡256−F(256))J = \pi(256) - \theta(256)/\log256 + c(256/\log256 - F(256)), where π(256)=54\pi(256) = 54 and θ(256)=∑p<256log⁡p\theta(256) = \sum_{p<256}\log p, and π−(x)=max⁡(0,(αx−5log⁡x+5−R(x))/log⁡x)\pi^{-}(x) = \max(0,(\alpha x - 5\log x + 5 - R(x))/\log x); below 256 both equal π(x)\pi(x). They follow by partial summation from Rosser and Schoenfeld’s ψ(x)<cx\psi(x) < cx [20 Theorem 12]. and ψ(x)≥αx−5log⁡x+5\psi(x) \ge\alpha x - 5 \log x + 5 for x≥30x \ge30, a weaker form of Chebyshev’s ψ(x)>Ax−52log⁡x−1\psi(x) > Ax - \frac{5}{2}\log x - 1, A=0.92129…A = 0.92129\ldots [7 §V], as proved in Lean in [12].

Computational and formal details

Finite computation

The prime pattern. That pp follows the first multiple of pp is [13 Lemma 1] (Lemma 2.1 in the journal version), and that this multiple is 2p2p is [11 Theorem 4.3]. Hofman and Pilipczuk prove the latter by a crossing count at the level 2p2p that closes for p>25000p > 25000, and cover smaller pp by the computation of 10710^7 terms in [13]; Haver [10 Remark 3] closes the same count for every p>43p > 43, leaving p≤43p \le43, which the first 82 terms show. The rest, 2p=E(Np−1)2p = E(N_p - 1), the uniqueness of 3p3p and the spacing, is proved in [10 (F2)]. In the Lean proof the primes p≤43p \le43 are checked on the first terms, 43<p<409643 < p < 4096 by a finite computation, and larger pp by explicit prime bounds.

The premises of Theorem 7 about the first LL terms are:

(Fa) for 1≤n≤L1 \le n \le L, 13n≤28a(n)13n \le28a(n) and 7a(n)≤12n7a(n) \le12n, with equality only at n=28n = 28 and n=7n = 7;

(Fb) E(L−2)≥e0E(L - 2) \ge e_0;

(Fc) K(s)≤329K(s) \le329 at every state ss with E(s)<e0E(s) < e_0.

They are established by computing a(1),…,a(L)a(1), \ldots, a(L) with the pointer rule (F1), keeping one pointer per prime, and tracking EE and KK. We find E(L)=16,230,216,746E(L) = 16,230,216,746. The frontier first reaches 1.413⋅10101.413 \cdot10^{10} at n=13,928,388,828<L−2n = 13,928,388,828 < L - 2, which gives (Fb) since EE is nondecreasing. The largest KK at states with E<1.413⋅1010E < 1.413 \cdot10^{10} is 329; since every state with E(s)<e0E(s) < e_0 comes before that crossing, this gives (Fc) for all states, not only those up to LL. The only equality cases are a(7)=12a(7) = 12 and a(28)=13a(28) = 13.

Two programs written independently, with different factorization methods, memory layouts and formulas for KK, compute these facts and agree; a third program checks the defining minimality property directly on the first 10810^8 terms.

Formal development

The foundation is Haver’s Lean archive [10] as extended in [9]. The analytic inputs reuse published formalizations: Rosser and Schoenfeld’s Theorem 12 and a form of Chebyshev’s lower bound from the IEANTN project [12] (with interval tools from LeanCert [14]), and the arithmetic large sieve from OpenAI’s formalizations [18], specifically OAI.Ostmann.publishedAdditiveLargeSieve in lean/OAI/NumberTheory/Ostmann/Preliminaries/AdditiveSieveProof.lean. The port preserves the retained statements and proofs; its imports are adapted to the pinned local toolchain. OpenAI’s arithmetic sieve already uses Farey separation 1/Q21/Q^2. Building on that sieve, we use the stronger separation 1/(Q2−1)1/(Q^2 - 1) for (BT), prove the bound G(Q)>log⁡(Q+1)+1.07G(Q) > \log(Q + 1) + 1.07 from the proof of [17 Lemma 7], and derive (BT) and the bounds (P).

Interval certificate

The certificate has 16,857 rows. Its first row is shown in Table 1; the complete table is in the Zenodo archive linked below the title. Each row supplies the integer parameters of Definition 6. The independent checker verifies the row inequalities, the common endpoints of consecutive intervals, monotonicity of MM, and the first and last endpoints. The checker uses exact integers and rationals with outward-rounded interval arithmetic.

ParameterFirst row
eae_a13,328,000,000
ebe_b13,341,330,000
MM28,017
YY266,194,600
QQ4,750
hch_c7,132,721,000
bqb_q90

Table 1. The first row of the interval certificate.

References

  1. [1]T. Haver, The Yellowstone permutation. III: few large terms, October 22, 2026, earlier on the day of this work’s first public release [6]. doi:10.5281/zenodo.23557280.DOI
  2. [2]T. Haver, The prime frontier of the Yellowstone permutation is linear, October 22, 2026, earlier on the day of this work’s first public release [6]. doi:10.5281/zenodo.23558450.DOI
  3. [3]T. Haver, The prime frontier of the Yellowstone permutation falls behind time: limsup R(t)/t < 1, October 23, 2026, after this work’s first public release on October 22, 2026 [6] (later work). doi:10.5281/zenodo.23604646.DOI
  4. [4]T. Haver, The Yellowstone permutation: limsup R(t)/t ≤ 0.68605, liminf nₙ/p > 1.4576, and Conjecture γ for large n, October 23, 2026, after this work’s first public release on October 22, 2026 [6] (later work). doi:10.5281/zenodo.23604811.
  5. [5]T. Haver, The Yellowstone permutation: Conjecture γ for all n reduced to a riser law on a finite range, the normality and entry times of primes, and a run certificate, October 23, 2026, after this work’s first public release on October 22, 2026 [6] (later work). doi:10.5281/zenodo.23604970.
  6. [7]P. L. Chebyshev, Mémoire sur les nombres premiers, J. Math. Pures Appl. 17 (1852), 366–390.
  7. [8]L. de Moura and S. Ullrich, The Lean 4 theorem prover and programming language, in Automated Deduction—CADE 28, LNCS 12699, Springer, 2021, pp. 625–635. doi:10.1007/978-3-030-79876-5_37.DOI
  8. [9]P. Graham, The second-order asymptotic of the EKG sequence, version 3, October 20, 2026, manuscript and Lean sources. doi:10.5281/zenodo.23493113.DOI
  9. [10]T. Haver, Explicit rates for the EKG sequence, version 3, October 4, 2026, manuscript and Lean sources (the Lean archive EKG–Lean4–sources–v2.zip, unchanged from version 2). doi:10.5281/zenodo.23129632.
  10. [11]P. Hofman and M. Pilipczuk, A few new facts about the EKG sequence, J. Integer Sequences 11 (2008), Article 08.4.2.
  11. [12]IEANTN contributors (T. Tao et al.), IEANTN, Lean sources, commit ec66e388e6e117c6881367f38665f310edf7cacf, 2026. Rosser–Schoenfeld Theorem 12 by Akula and contributors; Chebyshev bound by T. Tao. https://github.com/teorth/IEANTN.
  12. [13]J. C. Lagarias, E. M. Rains, and N. J. A. Sloane, The EKG sequence, Experimental Math. 11 (2002), 437–446. doi:10.1080/10586458.2002.10504486; arXiv:math/0204011v1. Numbered locators refer to arXiv version 1 unless marked “journal version”.DOI
  13. [14]LeanCert contributors, LeanCert, Lean sources, commit 6b11513512c9d27183fb4725bfc291ab38b4a6d7, 2026. https://github.com/alerad/leancert.
  14. [15]The mathlib Community, The Lean mathematical library, in Proceedings of CPP ’20, ACM, 2020, pp. 367–381. doi:10.1145/3372885.3373824.DOI
  15. [16]H. L. Montgomery, A note on the large sieve, J. London Math. Soc. 43 (1968), 93–98. doi:10.1112/jlms/s1-43.1.93.DOI
  16. [17]H. L. Montgomery and R. C. Vaughan, The large sieve, Mathematika 20 (1973), 119–134. doi:10.1112/S0025579300004708.DOI
  17. [18]OpenAI, math: mathematics formalizations, Lean sources, commit 1581d4cbdd69a0faf34b2089614fe2a814316a6a, 2026. https://github.com/openai/math.
  18. [19]OEIS Foundation Inc., The On-Line Encyclopedia of Integer Sequences, entry A064413.
  19. [20]J. B. Rosser and L. Schoenfeld, Approximate formulas for some functions of prime numbers, Illinois J. Math. 6 (1962), 64–94. doi:10.1215/ijm/1255631807.DOI
  20. [21]David L. Applegate, Hans Havermann, Robert G. S elcoe, Vladimir Shevelev, N. J. A. Sloane and Reinhard Zumkeller, The Yellowstone Permutation, arXiv:1501.01669, first posted January 7, 2015; version 2, March 8, 2015. https://arxiv.org/abs/1501.01669v2.
  21. [22]Amit Kumar Basistha and Eugen J. Ionascu, A special sequence and primorial numbers, arXiv:2302.02838, first posted February 6, 2023; version 5, November 22, 2023. Rev. Roumaine Math. Pures Appl. 70 (2025), 235–255. https://arxiv.org/abs/2302.02838v5. https://doi.org/10.59277/rrmpa.2025.235.255.
  22. [23]Sungsoo Na, An integer-visiting process with real multipliers: coverage and rates, version 1.0.0, October 4, 2026. https://doi.org/10.5281/zenodo.23138274.

Paper details

vlnc:W_f8uu5cdq
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 3

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Mathematics

AI models (from OpenAI and Anthropic)

View statement
Looking for related papers…
Contents