betaFeedback

WorksMathematics

Optimal single-track Gray codes from Gray-ordered necklaces

Abstract

A single-track Gray code of length nn is a cyclic Gray code of nn-bit words in which every column is a cyclic shift of the first. For prime nn the longest possible period is 2n−22^n-2. Whether it is attained for every prime has been open since Hiltgen, Paterson and Brandestini introduced these codes in 1996, and optimal codes were known for primes n≤19n\le 19. We show that a conjecture of Degni and Drisko (2007) on the reflected Gray code order of necklaces implies optimal single-track Gray codes for every prime. Their list of necklaces, conjecturally a Gray path for prime nn, closes into a Hamilton cycle of the necklace graph after (n−3)/2(n-3)/2 explicit Pósa rotations, and such a cycle lifts to an optimal code. This implication is formalized in Lean 4. Together with computation it gives optimal single-track Gray codes for every odd prime n≤47n\le 47: for n≤37n\le 37 explicit codes checked word by word by a program independent of the generator, and for n=41n=41, 4343 and 4747 codes obtained from the implication after the Degni-Drisko property was verified at these lengths by two independently written programs.

Introduction

A single-track Gray code of length nn and period PP is a cyclic sequence w0,…,wP−1w_0,\ldots,w_{P-1} of distinct nn-bit words in which consecutive words (cyclically) differ in exactly one bit, and in which every column is a cyclic shift of column 0: there are head positions h0=0,h1,…,hn−1h_0 = 0,h_1,\ldots,h_{n-1} with (wt)j=(wt+hj)0(w_t)_j = (w_{t+h_j})_0 for all tt and jj (indices mod PP). Hiltgen, Paterson and Brandestini [6] introduced these codes for absolute rotary encoders. They showed that for n≥3n \ge3 such a code contains neither 0n0^n nor 1n1^n and that 2n2^n divides PP. For prime nn the period is therefore at most 2n−22^n - 2, and a code of period 2n−22^n - 2 is called optimal. For nn a power of 2, Etzion and Paterson [2] constructed codes of period 2n−2n2^n - 2n, and Schwartz and Etzion [12] showed that this is best possible.

For prime nn, optimal codes were known for n≤19n \le19. Mütze’s survey [9 Section 3.12] records that existence “has been tested and confirmed for all prime n≤19n \le19” and lists the general question as open; Etzion [3] also lists the primes up to 19 as the known cases. Zhang and Zhu [13] list 2n−22^n - 2 as the optimal period with evenly spread heads for all primes n≤29n \le29, derived from counting arguments (the number of aperiodic necklaces and a necessary condition on the sequence of weights); they report codes “with length up to 17” and print none. We know of no published optimal single-track Gray code for a prime n≥23n \ge23.

Mütze [9 Section 3.12] describes the standard reduction. For prime nn every nonconstant necklace has nn distinct rotations, and an optimal code arises from a cyclic Gray code through the (2n−2)/n(2^n - 2)/n nonconstant necklaces, one representative each, in which the last representative is one flip away from a nontrivial rotation of the first. Lemma 1 shows that the nontriviality condition can always be met. The problem is therefore exactly the Hamiltonicity of the *necklace graph QnQ_n, whose vertices are the nonconstant necklaces of length nn and whose edges join necklaces having representatives at Hamming distance one.

Degni and Drisko [1] order necklaces by the first occurrence of a representative in the binary reflected Gray code (BRGC). They conjectured, and verified for n≤37n \le37, that consecutive necklaces in this order differ in a single bit except immediately after powers of odd primes (in their sense). For prime nn this says that their list is a Gray path through all necklaces, from 0n0^n to 1n1^n; this is the prime case of Savage’s question whether necklaces of odd length admit a Gray code [11], [9 Problem P17]. Without its constant ends the path runs from ⟨0n−11⟩\langle0^{n-1}1\rangle to ⟨01n−1⟩\langle01^{n-1}\rangle, which are not adjacent for n≥5n \ge5. We close it explicitly.

Theorem A. Let n≥7n \ge7 be prime. If the Degni–Drisko list of necklaces of length nn is a Gray path, then QnQ_n has a Hamilton cycle, obtained from the list by (n−3)/2(n-3)/2 Pósa rotations at explicit pivots, and an optimal single-track Gray code of length nn and period 2n−22^n - 2 exists.

Theorem B. Optimal single-track Gray codes exist for every odd prime n≤47n \le47. For n≤37n \le37 the codes are given explicitly and each has been checked word by word by a verifier independent of the generator (for n=3n = 3, Lean’s kernel); for n=41n = 41, 4343 and 4747 the codes are the ones produced by Theorem A, and the hypothesis of Theorem A was verified at these lengths by two independently written programs.

Theorem A is formalized in Lean 4 with Mathlib (ancillary files). The Lean theorem stgc_of_DD states that for every prime n≠2n \ne2 the Degni–Drisko property at nn, an explicit hypothesis, implies the existence of a single-track Gray code of length nn and period 2n−22^n - 2; its proof uses only Lean’s standard axioms. The hypothesis there, adjacency in QnQ_n of consecutive necklaces of DnD_n, is Conjecture 1 below. It is implied by the conjecture as stated in [1], which asks that consecutive first-occurrence words, constants included, differ in one bit. Lean proves the hypothesis itself only for n=5n = 5, by computation. For 7≤n≤377 \le n \le37 it was verified by Degni and Drisko [1], and for n=37n = 37, 4141, 4343 and 4747 by the computations of § 4.

From Hamilton cycles in the necklace graph to codes

Words are x=x1x2⋯xnx = x_1x_2 \cdots x_n, and ρ(x)=x2⋯xnx1\rho(x) = x_2 \cdots x_nx_1 is the left rotation; ⟨x⟩\langle x\rangle denotes the necklace (rotation class) of xx, and eie_i the word with a single 11 in position ii.

Lemma 1. Let nn be prime. If QnQ_n has a Hamilton cycle, then there is an optimal single-track Gray code of length nn, with equally spaced heads.

Proof. Let N0,…,Nm−1N_0, \ldots, N_{m-1} be the cycle, m=(2n−2)/nm = (2^n - 2)/n. Choose w0∈N0w_0 \in N_0 and, inductively, bits bib_i with wi+1=wi⊕ebi∈Ni+1w_{i+1} = w_i \oplus e_{b_i} \in N_{i+1} for i<m−1i < m - 1; finally choose bm−1b_{m-1} with wm−1⊕ebm−1∈N0w_{m-1} \oplus e_{b_{m-1}} \in N_0, say wm−1⊕ebm−1=ρs(w0)w_{m-1} \oplus e_{b_{m-1}} = \rho^s(w_0). If s≠0(modn)s \ne0 \pmod n, put Wqm+i=ρqs(wi)W_{qm+i} = \rho^{qs}(w_i) for 0≤q<n0 \le q < n, 0≤i<m0 \le i < m. Rotations are automorphisms of the cube, so consecutive words differ in one bit, also across the boundaries Wqm+m−1→W(q+1)m=ρ(q+1)s(w0)W_{qm+m-1} \to W_{(q+1)m} = \rho^{(q+1)s}(w_0) and cyclically since ns≡0ns \equiv0. The word Wqm+iW_{qm+i} lies in NiN_i, and q↦ρqs(wi)q \mapsto\rho^{qs}(w_i) is injective because ss is invertible mod nn and NiN_i has nn distinct rotations; so the 2n−22^n - 2 words are exactly the nonconstant words. Finally Wt+m=ρs(Wt)W_{t+m} = \rho^s(W_t) for all tt, so column ks mod nks \bmod n is column 0 delayed by kmkm, which is the single-track property with heads hks=−km mod (2n−2)h_{ks} = -km \bmod(2^n - 2).

It remains to make s≠0s \ne0. Rotate the cycle so that N0=⟨0n−11⟩N_0 = \langle0^{n-1}1\rangle and take w0=eaw_0 = e_a, a word with a single 11, in position aa; then w1=ea⊕ebw_1 = e_a \oplus e_b for some b≠ab \ne a. Identify a word with the set of positions of its ones, so that ρ\rho shifts every position down by one (mod nn), and put i≡b−a≠0(modn)i \equiv b-a \ne0 \pmod{n}. Replace the lift by w0′=w0w'_0=w_0 and wj′=ρi(wj)w'_j=\rho^i(w_j) for 1≤j<m1\le j<m. Since ρi(w1)={a−i,b−i}={2a−b,a}\rho^i(w_1)=\{a-i,b-i\}=\{2a-b,a\} contains aa, the first step w0′→w1′w'_0\to w'_1 is still a single flip; the later steps are single flips because ρi\rho^i is a cube automorphism; wj′∈Njw'_j\in N_j for all jj; and the closing step now ends at ρi(ρs(w0))=ρs+i(w0)\rho^i(\rho^s(w_0))=\rho^{s+i}(w_0). So the new shift is s+is+i, and since i≠0i\ne0, one of ss and s+is+i is nonzero.

The Degni–Drisko list and its closing

The BRGC lists g(t)=t⊕⌊t/2⌋g(t)=t\oplus\lfloor t/2\rfloor, t=0,…,2n−1t=0,\ldots,2^n-1, as nn-bit words with the most significant bit first. Its inverse is the prefix-parity map: rk⁡(x)=g−1(x)\operatorname{rk}(x)=g^{-1}(x) has binary digits π(x)i=x1⊕⋯⊕xi\pi(x)_i=x_1\oplus\cdots\oplus x_i. Hence for words of equal length, rk⁡(x)<rk⁡(y)\operatorname{rk}(x)<\operatorname{rk}(y) if and only if π(x)\pi(x) is lexicographically smaller than π(y)\pi(y). The first occurrence of a necklace is its rotation of smallest rank. Let DnD_n be the list of the nonconstant necklaces of length nn ordered by the ranks of their first occurrences. (Degni and Drisko list all necklaces; 0n0^n has rank 0 and 1n1^n is the only necklace whose first occurrence begins with 1, so DnD_n is a contiguous part of their list.)

Conjecture 1 (Degni–Drisko [1], prime case). For prime nn, consecutive necklaces of DnD_n are adjacent in QnQ_n.

Degni and Drisko verified their conjecture for n≤37n\le37 [1], Section 3. For composite odd nn the adjacency fails, for example at n=9n=9, 15 and 21, as the exceptions in their conjecture allow.

Let n≥7n\ge7 be odd and K=(n−3)/2K=(n-3)/2. Define the words

E0=01n−1,A0=01n−50111,E1=01n−50101.E_0=01^{n-1},\qquad A_0=01^{n-5}0111,\qquad E_1=01^{n-5}0101.

and for 1≤k≤K−11\le k\le K-1

Ak=02k+1101n−2k−3,Ek+1=02k+1101n−2k−501.A_k=0^{2k+1}101^{n-2k-3},\qquad E_{k+1}=0^{2k+1}101^{n-2k-5}01.

Thus EK=0n−41001E_K=0^{n-4}1001. Write ck=n−2k−3c_k=n-2k-3, which is even, with ck≥2c_k\ge2 for k≤K−1k\le K-1 and cK−1=2c_{K-1}=2. A Pósa rotation of a path P=(P0,…,PL)P=(P_0,\ldots,P_L) at a pivot PjP_j adjacent to the end PLP_L replaces PP by P0⋯PjPLPL−1⋯Pj+1P_0\cdots P_jP_LP_{L-1}\cdots P_{j+1}, whose new end is Pj+1P_{j+1}.

Lemma 2. For odd nn the first necklace of DnD_n is ⟨0n−11⟩\langle0^{n-1}1\rangle and the last is ⟨E0⟩\langle E_0\rangle.

Proof. The first claim holds because g(1)=0n−11g(1)=0^{n-1}1. The first occurrence of ⟨E0⟩\langle E_0\rangle is E0E_0 itself (rotations beginning with 1 have larger rank), with π(E0)=0(10)(n−1)/2\pi(E_0)=0(10)^{(n-1)/2}. Let X≠⟨E0⟩X\ne\langle E_0\rangle be a nonconstant necklace; it has at least two zeros. Let a1,…,aza_1,\ldots,a_z (z≥2z\ge2) be the lengths of the cyclic runs of ones between consecutive zeros. If all aia_i were odd, then n=z+∑ai≡2z≡0(mod2)n=z+\sum a_i\equiv2z\equiv0\pmod{2}, which is false; so some aia_i is even. The rotation w=01ai0⋯w=01^{a_i}0\cdots has prefix parities equal to those of E0E_0 up to position ai+1a_i+1, where both are 0; at position ai+2≤na_i+2\le n the parity of ww stays 0 while that of E0E_0 becomes 1. So rk⁡(w)<rk⁡(E0)\operatorname{rk}(w)<\operatorname{rk}(E_0), and the first occurrence of XX precedes that of ⟨E0⟩\langle E_0\rangle.

Lemma 3. ⟨Ak⟩\langle A_k\rangle and ⟨Ek⟩\langle E_k\rangle are adjacent in QnQ_n for 0≤k≤K−10\le k\le K-1.

Proof. Flipping position n−3n-3 of E0E_0 gives A0A_0. For k≥1k\ge1, the end before step kk is (a rotation of) 02k−11011ck010^{2k-1}10^{1}1^{c_k}01; its rotation 0102k−11011ck010^{2k-1}10^{1}1^{c_k} becomes AkA_k when its second bit is flipped. (For k=1k=1 this word is a rotation of E1E_1 as defined above.)

Lemma 4. AkA_k is the first occurrence of its necklace.

Proof. The prefix parity π(y)\pi(y) begins with exactly as many zeros as yy. For k≥1k \ge1, AkA_k begins with 02k+10^{2k+1} and ends with 1, its cyclic runs of zeros have lengths 2k+12k+1 and 1, and 2k+1≥32k+1 \ge3; so AkA_k is the only rotation whose prefix parity begins with 2k+12k+1 zeros, and it has the smallest rank. For k=0k=0 write A0=01a0111A_0=01^a0111 with a=n−5≥2a=n-5 \ge2 even. Rotations beginning with 1 are larger, and the only other rotation beginning with 0 is R=011101aR=01110 1^a. The prefix parities of A0A_0 and RR agree in positions 1–3; if a=2a=2, position 4 gives 0 for A0A_0 and 1 for RR, and if a≥4a \ge4 they agree in position 4 and position 5 gives 0 for A0A_0 and 1 for RR.

Lemma 5. g(rk⁡(Ak)+1)=Ek+1g(\operatorname{rk}(A_k)+1)=E_{k+1}, and Ek+1E_{k+1} is the first occurrence of its necklace. Hence ⟨Ek+1⟩\langle E_{k+1}\rangle immediately follows ⟨Ak⟩\langle A_k\rangle in DnD_n.

Proof. The words g(r)g(r) and g(r+1)g(r+1) differ exactly in the position of the lowest set bit of r+1r+1. The word AkA_k ends in an even block of ones preceded by a zero (for k≥1k \ge1 the block 1kc1^c_k, entered with parity 1; for k=0k=0 the block 111, entered with parity 0), so π(Ak)\pi(A_k) ends in 01; thus r=rk⁡(Ak)≡1(mod4)r=\operatorname{rk}(A_k)\equiv1 \pmod{4}, the lowest set bit of r+1r+1 is in position n−1n-1, and flipping position n−1n-1 of AkA_k gives Ek+1E_{k+1}. For k≥1k \ge1, Ek+1E_{k+1} begins with 02k+10^{2k+1}, ends with 1, and its other runs of zeros have length 1 or 2, so the argument of Lemma 4 applies. For k=0k=0, the rotations of E1=01a0101E_1=01^a0101 beginning with 0 are E1E_1, 010101a01010 1^a and 0101a01010 1^a01, whose prefix parities begin 010, 011 and 011. Since Ek+1E_{k+1} is the BRGC successor of AkA_k and is a first occurrence, no necklace has its first occurrence strictly between them.

Lemma 6. Let jkj_k be the position of ⟨Ak⟩\langle A_k\rangle in DnD_n. Starting from DnD_n and performing the Pósa rotations at ⟨A0⟩,⟨A1⟩,…,⟨AK−1⟩\langle A_0\rangle,\langle A_1\rangle,\ldots,\langle A_{K-1}\rangle in turn is legal, and after the rotation at ⟨Ak⟩\langle A_k\rangle the end of the path is ⟨Ek+1⟩\langle E_{k+1}\rangle.

Proof. By Lemma 5, ⟨Ek+1⟩\langle E_{k+1}\rangle is at position jk+1j_k+1. For k=0k=0: comparing prefix parities, rk⁡(A0)<rk⁡(E1)<rk⁡(E0)\operatorname{rk}(A_0)<\operatorname{rk}(E_1)<\operatorname{rk}(E_0) (the words agree up to position n−4n-4, and at position n−3n-3 the parity is 0 for E1E_1 and 1 for E0E_0), so j0+1j_0+1 is strictly before the end, ⟨A0⟩\langle A_0\rangle is neither the end nor its predecessor, and by Lemma 3 the rotation is legal with new end ⟨E1⟩\langle E_1\rangle. For k≥1k \ge1: AkA_k begins with exactly 2k+12k+1 zeros and Ak−1A_{k-1} with 02k−110^{2k-1}1, so rk⁡(Ek+1)=rk⁡(Ak)+1≤2n−2k−1<2n−2k≤rk⁡(Ak−1)\operatorname{rk}(E_{k+1})=\operatorname{rk}(A_k)+1\le2^{n-2k-1}<2^{n-2k}\le\operatorname{rk}(A_{k-1}), and since DnD_n is ordered by rank, jk+1<jk−1j_k+1<j_{k-1}. After the rotation at ⟨Ak−1⟩\langle A_{k-1}\rangle the path is P0⋯Pjk−1P_0\cdots P_{j_{k-1}} followed by reversed material, with end ⟨Ek⟩\langle E_k\rangle; both ⟨Ak⟩\langle A_k\rangle and ⟨Ek+1⟩\langle E_{k+1}\rangle lie in the untouched prefix, at consecutive positions, so the rotation at ⟨Ak⟩\langle A_k\rangle (legal by Lemma 3) has new end ⟨Ek+1⟩\langle E_{k+1}\rangle.

Proof of Theorem A. By Lemma 2 and the hypothesis, DnD_n is a Hamilton path of QnQ_n from ⟨0n−11⟩\langle0^{n-1}1\rangle to ⟨E0⟩\langle E_0\rangle. By Lemma 6 the KK rotations produce a Hamilton path from ⟨0n−11⟩\langle0^{n-1}1\rangle (the start never moves) to ⟨EK⟩=⟨0n−41001⟩\langle E_K\rangle=\langle0^{n-4}1001\rangle, which is adjacent to ⟨0n−11⟩\langle0^{n-1}1\rangle. This is a Hamilton cycle; apply Lemma 1.

Computations

Codes for 5≤n≤315 \le n \le31 by search. We found Hamilton cycles in QnQ_n for all primes 5≤n≤315 \le n \le31 by Pósa rotation and extension [10], with Warnsdorff extension and a closing look-ahead, started from the Degni–Drisko list or from a greedy path. The search took under 2 seconds for n=23n=23, 3.5 and 12 minutes for two codes at n=29n=29, and 17 minutes and 20.6 GB of memory for n=31n=31. Each code was expanded to its full period and checked by at least two independent programs among a C bitset checker, a NumPy checker that reads only the track and the head positions, and, for n=23n=23, 29 and 31, two further independently written checkers.

Codes from Theorem A. The construction of Theorem A is algorithmic: the first occurrences can be enumerated in rank order with O(n)O(n) work each, and the cycle is a concatenation of K+1K+1 segments of DnD_n, traversed forwards or backwards. Our implementation enumerates DnD_n in parallel, checks Conjecture 1 along the way, assembles the cycle, and lifts it to a flip sequence of length m=(2n−2)/nm=(2^n-2)/n together with the shift ss. For 7≤n≤297\le n\le29 the resulting codes pass the C bitset checker, the NumPy checker and the flip-sequence verifier described next. For n=37n=37 the code has m=3,714,566,310m=3{,}714{,}566{,}310 and s=2s=2; it was produced in 15 minutes on four cores. A separately written verifier regenerated all 237−22^{37}-2 words from the flip sequence, marking them in a 2372^{37}-bit table, and confirmed that every nonconstant word occurs exactly once, that the nn passes chain with shift 2, and that the sequence closes.

The Degni–Drisko property at n=41n=41, 4343, 4747. By Theorem A, a code for prime nn follows from Conjecture 1 at nn. We verified it by streaming the BRGC ranks with constant memory per thread. At n=41n=41, D41D_{41} has 53,634,713,550 necklaces, every consecutive pair is adjacent, and the list runs from ⟨0401⟩\langle0^{40}1\rangle to ⟨0140⟩\langle01^{40}\rangle (77 minutes on four cores). A second program, written independently without access to the first (it computes the ranks of all rotations incrementally and scans only ranks below 2n−12^{n-1}), confirmed the same count, the same first and last necklaces and no non-adjacent pair (36 minutes on four cores); it also confirmed n=37n=37. At n=43n=43 (204,560,302,842 necklaces) both programs found every consecutive pair adjacent (4.7 and 3.0 hours on four cores, respectively). At n=47n=47 (2,994,414,645,858 necklaces) both programs, with checkpointing, again found every consecutive pair adjacent and the expected first and last necklaces (64 and 55 hours of wall time, respectively, on four cores of a shared laptop).

nnperiod 2n−22^n-2methodverification
36explicitLean (decide)
5–19≤524,286\le524{,}286search; Theorem A (n≥7n\ge7)word by word, 2 checkers
238,388,606search (s=1s=1, s=11s=11)word by word, ≥3\ge3 checkers
29536,870,910search (s=12s=12, s=16s=16)word by word, ≥3\ge3 checkers
312,147,483,646search (s=28s=28)word by word, ≥3\ge3 checkers
37137,438,953,470Theorem A (s=2s=2)word by word, 1 checker
412,199,023,255,550Theorem AConjecture 1 at n=41n=41, 2 programs
438,796,093,022,206Theorem AConjecture 1 at n=43n=43, 2 programs
47140,737,488,355,326Theorem AConjecture 1 at n=47n=47, 2 programs

Table 1. Optimal single-track Gray codes. “Word by word” means that a program written separately from the generator regenerated every word of the period. For n=41n=41, 4343, 4747 the codes are the explicit ones of Theorem A; they were not expanded.

Further observations and open problems

Symmetric chains. Griggs, Killian and Savage [4] (see also [7]) gave, for prime nn, a rotation-invariant symmetric chain decomposition of the Boolean lattice; it induces a decomposition of QnQ_n into paths. Gregor, Mička and Mütze [5] proved that the Greene–Kleitman decomposition of the cube extends to a Hamilton cycle and conjectured that every symmetric chain decomposition does.

Conjecture 2. For every prime nn the Griggs–Killian–Savage chains (with 0n0^n and 1n1^n removed) extend to a Hamilton cycle of QnQ_n.

We found such cycles for every prime 7≤n≤237 \le n \le23 by a search on the chains as two-ended super-vertices. Every chain has an odd number of edges, so chain bottoms are joined only to bottoms and tops only to tops, apart from joins between chains of the middle two levels; these cycles are “cycle orderings” in the sense of [5].

Central levels. Merino, Mička and Mütze [8] showed that the middle two levels of the cube have a Hamilton cycle invariant under rotation, for every odd nn; in particular, the middle two levels of the necklace graph are Hamiltonian, for prime and composite odd nn.

Conjecture 3. For every odd n=2m+1≥5n = 2m + 1 \ge5 and every 1≤ℓ≤m1 \le\ell\le m, the subgraph of the necklace graph induced by the necklaces of weight in [m+1−ℓ,m+ℓ][m + 1 - \ell,m + \ell] is Hamiltonian.

The case ℓ=1\ell= 1 is the theorem of [8], and the case ℓ=m\ell= m, nn prime, is equivalent (by Lemma 1) to the existence of optimal single-track Gray codes. Our search found such Hamilton cycles, checked by the search program itself, for all odd n≤19n \le19 and all ℓ\ell. For ℓ=m\ell= m and n=9n = 9, 1313, 1515, 2121, 2525 (periodic necklaces included for composite nn) the cycles also passed an independent checker.

Structure of the Degni–Drisko conjecture. Degni and Drisko prove that the strings skipped between consecutive Gray necklaces are covered by their “symmetric intervals”, note that removing a single such interval preserves Hamming distance one, and identify several intervals as the difficulty [1 Section 8]. For prime n≤13n \le13 every gap between consecutive necklaces of DnD_n is a single symmetric interval. This fails at n=17n = 17 and n=19n = 19: in all 7 and 21 exceptional gaps, respectively, the gap consists of exactly three symmetric intervals, a central one flanked by two whose generators have equal length, between n−5n - 5 and n−3n - 3.

Ancillary files

The arXiv ancillary files contain the Lean 4 project (lean/, with toolchain and Mathlib pins), the programs for the search, the construction of Theorem A and the verifiers, the tracks and head positions of the search codes for 5≤n≤235 \le n \le23 (the tracks for n=29n = 29 and 3131, 0.5 and 2.1 GB uncompressed, exceed arXiv’s size limit and are available at https://github.com/dzoba/single-track-gray-codes), and the logs of the Degni–Drisko verifications at n=37n = 37, 4141, 4343 and 4747 and of the checks described in § 4. The n=37n = 37 flip sequence (3.7 GB, SHA-256 0a0c91ea19527ee4812ff2b0d8627d3abe6e0d4fbaad611a48efbb13f8c5b811) can be regenerated by the included construction program.

Use of AI tools

This work was carried out with AI systems under the author’s direction. Claude (Anthropic) wrote and ran the searches and verifiers, found the closing pivots of Theorem A by computer search, wrote the proofs and the Lean formalization, and drafted the text. The word-by-word verifiers share no code with the generators, and the second Degni–Drisko checker was written by a separate AI instance from a specification only. Separate instances refereed the proof and the formalization, and Codex (OpenAI) wrote two further checkers and checked the codes for n=23n = 23, 29 and 31. The author is responsible for the content.

References

  1. [1]C. Degni and A. A. Drisko, Gray-ordered binary necklaces, Electron. J. Combin. 14 (2007), #R7.DOI
  2. [2]T. Etzion and K. G. Paterson, Near optimal single-track Gray codes, IEEE Trans. Inform. Theory 42 (1996), 779–789.DOI
  3. [3]T. Etzion, Binary and non-binary self-dual sequences and maximum period single-track Gray codes, arXiv:2512.09655 (2025).arxiv.org/abs/2512.09655
  4. [4]J. Griggs, C. E. Killian and C. D. Savage, Venn diagrams and symmetric chain decompositions in the Boolean lattice, Electron. J. Combin. 11 (2004), #R2.DOI
  5. [5]P. Gregor, O. Mička and T. Mü​tze, On the central levels problem, J. Combin. Theory Ser. B 160 (2023), 163–205.arxiv.org/abs/1912.01566
  6. [6]A. P. Hiltgen, K. G. Paterson and M. Brandestini, Single-track Gray codes, IEEE Trans. Inform. Theory 42 (1996), 1555–1561.
  7. [7]C. E. Killian, F. Ruskey, C. D. Savage and M. Weston, Half-simple symmetric Venn diagrams, Electron. J. Combin. 11 (2004), #R86.DOI
  8. [8]A. Merino, O. Mička and T. Mü​tze, On a combinatorial generation problem of Knuth, SIAM J. Comput. 51 (2022), 379–423.
  9. [9]T. Mü​tze, Combinatorial Gray codes—an updated survey, Electron. J. Combin. (2023), Dynamic Survey DS26.arxiv.org/abs/2202.01280
  10. [10]L. Pósa, Hamiltonian circuits in random graphs, Discrete Math. 14 (1976), 359–364.DOI
  11. [11]C. D. Savage, A survey of combinatorial Gray codes, SIAM Rev. 39 (1997), 605–629.DOI
  12. [12]M. Schwartz and T. Etzion, The structure of single-track Gray codes, IEEE Trans. Inform. Theory 45 (1999), 2383–2396.DOI
  13. [13]F. Zhang and H.-j. Zhu, Determination of optimal period of absolute encoders with single track cyclic Gray code, J. Cent. South Univ. Technol. 15 (Suppl. 2) (2008), 362–366.DOI

Paper details

vlnc:W_r3hh69sz
Version
v1 · latest
Published
Added
License
CC BY 4.0
Usage

views · 17

downloads · 0

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

  • Mathematics

Claude, a separate AI instance, Codex

View statement
Looking for related papers…
Contents