arXiv:2610.05914math.NTOct 2026

Manuscript Offprint

arXiv:2610.05914

Conflict-avoiding codes and near-primitive roots

C. G. Karthick Babu, Pieter Moree, Sunil Kumar Pasupulati, Pietro Sgobba

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

C. G. KARTHICK BABU, PIETER MOREE, SUNIL KUMAR PASUPULATI, AND PIETRO SGOBBA

ABSTRACT. An important role in the theory of conflict-avoiding codes is played by a quantity involving the multiplicative order of 4 modulo dd, with dd running over all positive divisors of an odd integer nn. We establish results on its distribution as nn varies over the odd prime numbers, respectively odd integers, using techniques from the study of Artin's primitive root conjecture. We also point out some other interpretations of this quantity, with one of them making a connection with the factorization of Xn−1X^n - 1 into irreducibles over the finite field F2\mathbb{F}_2.

1. INTRODUCTION

Conflict-avoiding codes have been investigated as protocol sequences for use in a multiple-access (collision) channel without feedback [14, 27, 37, 23, 40]. For a detailed technical description of this multiple-access channel model, we refer the reader to [3, 26].

In mathematical terms, the definition is as follows: Given any positive integer nn, we let Zn\mathbb{Z}_n denote the ring of integers modulo nn, and let P(n,k)\mathcal{P}(n, k) represent the set of all kk-element subsets of Zn\mathbb{Z}_n. Each element x∈P(n,k)x \in \mathcal{P}(n, k) can be associated with a binary sequence of length nn and weight kk, indicating the positions of the nonzero entries. For a given subset x∈P(n,k)x \in \mathcal{P}(n, k), we define its difference set as follows:

Δ(x):={a−b( mod n):a,b∈x,  a≠b}.\Delta(x):=\{a-b(\bmod n):a,b\in x,\;a\neq b\}.

Note that ∣Δ(x)∣≤k(k−1)|\Delta(x)| \leq k(k-1), and if i∈Δ(x)i \in \Delta(x), then n−i∈Δ(x)n - i \in \Delta(x) as well; that is, Δ(x)\Delta(x) is symmetric with respect to n/2n/2. A conflict-avoiding code (CAC) of length nn and weight kk is defined as a subset C⊂P(n,k)\mathcal{C} \subset \mathcal{P}(n, k) such that for any distinct x,y∈Cx, y \in \mathcal{C}, the intersection Δ(x)∩Δ(y)\Delta(x) \cap \Delta(y) is empty. Each element x∈Cx \in \mathcal{C} is referred to as a codeword of length nn and weight kk. Without loss of generality, we can assume that all codewords contain 0. For example C={{0,1,6},{0,4,8}}\mathcal{C} = \{\{0, 1, 6\}, \{0, 4, 8\}\} is a CAC of length 11 and weight 3, with the codewords corresponding to the binary protocol sequences (1,1,0,0,0,0,1,0,0,0,0)(1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0), respectively (1,0,0,0,1,0,0,0,1,0,0)(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0).

For given nn and kk, let CAC(n,k)\mathrm{CAC}(n,k) denote the class of all CACs of length nn with weight kk. The maximum possible size of the codes in CAC(n,k)\mathrm{CAC}(n,k) will be denoted by M(n,k)M(n,k), i.e.,

M(n,k):=max⁡{∣C∣:C∈CAC(n,k)}.M(n,k):=\max\{|\mathcal{C}|:\mathcal{C}\in\mathrm{CAC}(n,k)\}.

A code C∈CAC(n,k)\mathcal{C} \in \mathrm{CAC}(n, k) is said to be optimal, if ∣C∣=M(n,k)|\mathcal{C}| = M(n, k). The above example is optimal in CAC(11,3)\mathrm{CAC}(11, 3), that is, M(11,3)=2M(11, 3) = 2 (as is easily deduced using the Pigeonhole Principle). Zhang, Lo and Wong [45] constructed several families of optimal strongly conflict-avoiding codes of even length and weight three.

2020 Mathematics Subject Classification. Primary: 94B25; Secondary: 11N37.

Key words and phrases. Conflict-avoiding codes, near-primitive root, multiplicative order, asymptotic counting, graph, irreducibility, Cauchy-Frobenius identity.

KARTHICK BABU, MOREE, PASUPULATI, AND SGOBBA

1.1. Equi-difference conflict-avoiding codes. A codeword x∈P(n,k)x \in P(n, k) is said to be equi-difference (or centered in the case k=3k = 3) with generator i∈Zn∖{0}i \in \mathbb{Z}_n \setminus \{0\} if it has the form

x=xi={0,i,2i,…,(k−1)i}( mod n),x=x_{i}=\{0,i,2i,\ldots,(k-1)i\}(\bmod n),

and consists of kk distinct residues modulo nn. A code C⊂P(n,k)\mathcal{C} \subset P(n, k) is called an equi-difference conflict-avoiding code if every codeword in C\mathcal{C} is equi-difference. It is denoted CACe(n,k)\mathrm{CAC}^e(n, k). Note that for an equi-difference codeword xix_i, we have

Δ(xi)={±ji( mod n):1≤j≤k−1},\Delta(x_{i})=\{\pm j i\left(\bmod n\right):1\leq j\leq k-1\},

which implies that ∣Δ(xi)∣≤2(k−1)|\Delta(x_i)| \leq 2(k-1). A codeword satisfying ∣Δ(xi)∣≤2(k−1)|\Delta(x_i)| \leq 2(k-1) is said to be exceptional. Moreover, an optimal code C∈CAC(n,k)\mathcal{C} \in \mathrm{CAC}(n, k) is said to be tight if

∪x∈CΔ(x)=Zn∖{0}.\cup_{x\in\mathcal{C}}\Delta(x)=\mathbb{Z}_{n}\setminus\{0\}.

The maximum code size in CACe(n,k)\mathrm{CAC}^{e}(n,k) will be denoted by Me(n,k)M^{e}(n,k), i.e.,

Me(n,k)=max⁡{∣C∣:C∈CACe(n,k)}.M^{e}(n,k)=\max\{|\mathcal{C}|:\mathcal{C}\in\mathrm{C A C}^{e}(n,k)\}.

For the remainder of this section we take k = 3. It is easy to verify that a general codeword x satisfies

2≤∣Δ(x)∣≤6.2\leq|\Delta(x)|\leq6.

Moreover, if ∣Δ(x)∣=4|\Delta(x)| = 4, then xx must be an equi-difference codeword. For exceptional codewords, we have:

• ∣Δ(x)∣=2|\Delta(x)| = 2 if and only if 3∣n3 \mid n and x={0,n/3,2n/3}x = \{0, n/3, 2n/3\},

• ∣Δ(x)∣=3|\Delta(x)| = 3 if and only if 4∣n4 \mid n and x={0,n/4,n/2}x = \{0, n/4, n/2\},

and both of these are also equi-difference.

1.2. A graph associated to CAC(n,3)\mathrm{CAC}(n,3). For simplicity of notation, we write CAC(n)\mathrm{CAC}(n) and M(n)M(n) instead of CAC(n,3)\mathrm{CAC}(n,3), respectively M(n,3)M(n,3). Likewise, we denote CACe(n,3)\mathrm{CAC}^{e}(n,3) and Me(n,3)M^{e}(n,3) by CACe(n)\mathrm{CAC}^{e}(n), respectively Me(n)M^{e}(n). Following Momihara [29] we now define a graph GnG_{n} connected with equi-difference codewords. A closely related graph-theoretic description is also used by Mishima and Momihara [28] in their construction of a new family of optimal tight conflict-avoiding codes.

Definition 1. Given an odd natural number n, define a graph Gn=(V,E)G_n = (V, E) as follows:

• The vertex set is

V={1,2,…,(n−1)/2}.V=\{1,2,\ldots,(n-1)/2\}.

• The edge set E⊆V×VE \subseteq V \times V consists of ordered pairs (a,b)(a, b) such that

b≡±2a(modn).b\equiv\pm2a\pmod{n}.

A vertex i∈V(Gn)i \in V(G_n) can be viewed as representing the difference ±i\pm i, and thus, an edge (a,b)(a, b) corresponds to the equi-difference codeword 0, a, 2a. A loop in GnG_n represents the special equi-difference codeword 0, n/3n/3, 2n/32n/3, which arises only when 3∣n3 \mid n. The graph GnG_n decomposes as a collection of disjoint cycles. This follows from the fact that the edge condition defines a permutation on the vertex set V. By identifying xx and −x-x, the set V represents the non-zero elements of ZnZ_n up to sign. The edge condition b≡±2a(modn)b \equiv \pm 2a \pmod{n} acts as multiplication by 2 in this quotient space. Since by assumption nn is odd, the number 2 is invertible modulo nn. Consequently, the mapping a↦±2a(modn)a \mapsto \pm 2a \pmod{n} is a bijection, guaranteeing that every vertex in GnG_n has an in-degree and out-degree of exactly 1. Equivalently, the reachability between vertices can be formalized by the relation a∼ba \sim b if and only if b≡±2ra(modn)b \equiv \pm 2^r a \pmod{n} for some integer rr. Because 2 is invertible in ZnZ_n, this satisfies the properties of an equivalence relation. The resulting equivalence classes partition VV into distinct connected components, which strictly correspond to the disjoint cycles of the graph.

Definition 2. Given any odd natural number nn, we let O(n)\mathcal{O}(n) denote the number of cycles of odd length in GnG_n, where a loop is considered a cycle of length 1. For convenience, we put O(1)=0\mathcal{O}(1) = 0.

For example, G21G_{21} has three cycles: (7), (3, 6, 9), and (1, 2, 4, 8, 5, 10), and hence O(21)=2\mathcal{O}(21) = 2. The cycle (7) is considered a loop.

Recall that for any two distinct codewords x≠yx \neq y, the condition Δ(x)∩Δ(y)=∅\Delta(x) \cap \Delta(y) = \varnothing must be satisfied. To construct as many codewords as possible, we aim to maximize the number of disjoint vertex subsets, where each vertex subset SS falls into one of the following three categories:

(a) ∣S∣=1|S| = 1: the induced subgraph is a loop,

(b) ∣S∣=2|S| = 2: the induced subgraph is a single edge,

(c) S={a,b,c}S = \{a, b, c\} such that a+b≡±c(modn)a + b \equiv \pm c \pmod{n}.

Note that for any odd integer nn, the graph GnG_n contains at most one loop. Since each equidifference codeword corresponds to an edge in GnG_n, constructing an optimal code C∈CACe(n)\mathcal{C} \in \mathrm{CAC}^e(n) amounts to finding a maximal matching in GnG_n, excluding the loop (recall that a matching MM in a graph G=(V,E)G = (V, E) is a subset of the edge set EE such that no two distinct edges in MM share a common vertex). Moreover, since each vertex i∈V(Gn)i \in V(G_n) represents the difference ±i\pm i, a tight equi-difference code C∈CACe(n)\mathcal{C} \in \mathrm{CAC}^e(n) exists if and only if there is a matching that covers all vertices of GnG_n. Given that GnG_n is a disjoint union of cycles, such a matching is possible if and only if every cycle has even length. As a consequence, we obtain the following proposition.

Proposition 1. [10, Prop. 1] Given an odd integer n≥3n \geq 3, a tight equi-difference code C∈CACe(n)\mathcal{C} \in \mathrm{CAC}^e(n) exists if and only if 3∤n3 \nmid n and O(n)=0\mathcal{O}(n) = 0, or 3∣n3 \mid n and O(n)=1\mathcal{O}(n) = 1.

The reader might wonder why the 3 divisibility of n plays a role. This is due to the existence of the special equi-difference codeword (0,n/3,2n/3)(0, n/3, 2n/3) which of course only occurs if 3∣n3 \mid n.

Making use of some existing results it is not difficult to quantify Proposition 1 (for a proof see Section 10). The big oh notation for the error terms is explained in any book on analytic number theory, for example in that of Apostol [2, p. 53]. The notation O\mathcal{O} is in this paper solely used for the quantity defined in Definition 2.

Theorem 1. Let P(x)P(x) and N(x)N(x) denote the number of primes, respectively odd integers 1≤n≤x1 \leq n \leq x, for which a tight equi-difference code of length n exists. We have

P(x)=512xlog⁡x+O(xlog⁡log⁡x(log⁡x)7/6)andN(x)=Cx(log⁡x)7/12+O(x(log⁡log⁡x)5(log⁡x)19/12),P(x)=\frac{5}{12}\frac{x}{\log x}+O\Big(\frac{x\log\log x}{(\log x)^{7/6}}\Big)\quad and\quad N(x)=C\frac{x}{(\log x)^{7/12}}+O\Big(\frac{x(\log\log x)^{5}}{(\log x)^{19/12}}\Big),

with CC a positive constant. More precisely, if C0C_0 denotes the constant appearing in Theorem 5, then C=43C0≈0.4298…C = \frac{4}{3}C_0 \approx 0.4298 \ldots

More generally, Proposition 1 makes clear the importance of understanding which values are assumed by O(n)\mathcal{O}(n) and for how many odd integers 1≤n≤x1 \leq n \leq x they get assumed as xx gets large. This is a delicate question that we intend to discuss in greater depth in a future paper. Here we present some alternative interpretations of O(n)\mathcal{O}(n) and study O(p)\mathcal{O}(p) in detail as pp runs through the primes, something that also has a coding theoretic relevance, as becomes particularly clear in Section 8. The techniques used will come mainly from the analytic and algebraic number

KARTHICK BABU, MOREE, PASUPULATI, AND SGOBBA

theory used to deal with variations of Artin’s primitive root conjecture. A good inkling of the mathematics involved can be obtained from the survey [33]. Many results in this area, also in this paper, will be under the Generalized Riemann Hypothesis (GRH), by which we mean that each Dedekind zeta-function has only non-trivial zeros on the half-line ℜ(s)=1/2\Re(s) = 1/2. Indeed, typically this assumption is only required for the Dedekind zeta-functions of the number fields involved in the proof of the result.

1.3. Description of the main results. Before turning to the distributional questions, we first develop several complementary descriptions of the quantity O(n)\mathcal{O}(n). We recall the formula of Fu, Lo and Shum [10] in terms of ordd(2)\text{ord}_d(2) and derive an equivalent formulation using ordd(4)\text{ord}_d(4). In particular, for an odd prime pp, this gives a particularly simple description of O(p)\mathcal{O}(p) in terms of the index of 4 modulo pp. This description also admits a group-theoretic interpretation. Introducing the graph HpH_p, whose vertices are the non-zero squares modulo pp and whose edges are induced by multiplication by 4, we show that HpH_p is isomorphic to GpG_p. Consequently, whenever O(p)>0\mathcal{O}(p) > 0,

O(p)=[(Fp×)2:⟨4⟩]=[Fp×:⟨−1,2⟩].\mathcal{O}(p)=[(\mathbb{F}_{p}^{\times})^{2}:\langle4\rangle]=[\mathbb{F}_{p}^{\times}:\langle-1,2\rangle].

This also gives a short reproof of a result of Fu, Lo and Shum [10].

A different interpretation of O(n)\mathcal{O}(n) is obtained through the factorization of xn−1x^n - 1 over F2\mathbb{F}_2. More precisely, O(n)\mathcal{O}(n) can be recovered by counting certain pairs of distinct reciprocal irreducible factors of odd degree together with self-reciprocal irreducible factors whose degrees are congruent to 2 modulo 4. This interpretation recovers the preceding order formulas and also leads to the characterization of Wu and Fu [44] in case the length of the code is a number of the form 2e±12^e \pm 1.

Finally, by viewing multiplication by a as an automorphism of the additive group Zm\mathbb{Z}_m, we use the Cauchy–Frobenius identity to obtain an explicit formula for the number of odd-length orbits of a general multiplication map. Specializing this description to multiplication by 2 yields another formula for O(n)\mathcal{O}(n).

In the remaining part of the section we describe our analytic number theory results.

1.3.1. Results on the distribution of O(p)\mathcal{O}(p) for prime pp. Let k≥0k \geq 0 be an integer. Put

Pk:={p>2:O(p)=k}P_{k}:=\{p>2:\mathcal{O}(p)=k\}

and let Pk(x)P_k(x) denote the number of primes p≤xp \leq x in PkP_k. The counting function P0(x)P_0(x) satisfies, by Proposition 1, the same asymptotic as that given for P(x)P(x) in Theorem 1.

Theorem 2 (under GRH). Let k≥1k \geq 1 be an integer. The set of primes PkP_k has a natural density δk\delta_k given by

δk=A⋅E(k)⋅{1ifkisodd;0ifk≡2(mod4);2/3if4∣k,\delta_{k}=A\cdot E(k)\cdot\begin{cases}1&if k is odd;\\0&if k\equiv2(mod4);\\2/3&if4\mid k,\end{cases}

with

A:=∏primeq(1−1q(q−1))=0.3739558136192022880547280543464…,A:=\prod_{p r i m e q}\left(1-\frac{1}{q(q-1)}\right)=0.3739558136192022880547280543464\ldots,

the Artin constant and

E(k):=1k2∏q∣kq2−1q2−q−1.(1)E(k):=\frac{1}{k^{2}}\prod_{q\mid k}\frac{q^{2}-1}{q^{2}-q-1}. \tag{1}

Moreover, asymptotically in x,

Pk(x)=δkxlog⁡x+Ok(xlog⁡log⁡xlog⁡2x).P_{k}(x)=\delta_{k}\frac{x}{\log x}+O_{k}\Big(\frac{x\log\log x}{\log^{2}x}\Big).

In case k≡2(mod4)k \equiv 2 \pmod{4}, we have Pk(x)=0P_k(x) = 0.

The techniques used to deal with PkP_k can also be used to study the level sets of O(p)\mathcal{O}(p) within a prescribed arithmetic progression. For coprime positive integers aa and dd, put

Pk(a,d)(x):=#{p≤x:p≡a( mod d),O(p)=k}.P_{k}(a,d)(x):=\#\{p\leq x:p\equiv a(\bmod d),\mathcal{O}(p)=k\}.

For k≥1k \geq 1, Theorem 11 gives, under GRH, an asymptotic formula for Pk(a,d)(x)P_k(a, d)(x). The cases k=0k = 0 and k=1k = 1 admit particularly explicit descriptions. For k=0k = 0 the result is unconditional and the corresponding rational density is described explicitly in Theorem 12. For k=1k = 1, we obtain the following more explicit result.

Theorem 3. Let a and d be coprime positive integers. Under GRH, we have

P1(a,d)(x)=ρ(d,a)φ(d)xlog⁡x+Od(xlog⁡log⁡x(log⁡x)2),(2)P_{1}(a,d)(x)=\frac{\rho(d,a)}{\varphi(d)}\frac{x}{\log x}+O_{d}\Big(\frac{x\log\log x}{(\log x)^{2}}\Big), \tag{2}

with

ρ(d,a)=c(d,a)R(d,a)A,\rho(d,a)=c(d,a)R(d,a)A,

where

R(d,a):=2∏p∣(a−1,d)(1−1p)∏p∣d(1+1p2−p−1),R(d,a):=2\prod_{p|(a-1,d)}\Big(1-\frac{1}{p}\Big)\prod_{p\mid d}\Big(1+\frac{1}{p^{2}-p-1}\Big),

and

c(d,a):={1/2if4∤d;1if4∣d,a≡3(mod4);0if4∣d,a≡1(mod4).c(d,a):=\begin{cases}1/2&if4\nmid d;\\1&if4\mid d,a\equiv3(mod4);\\0&if4\mid d,a\equiv1(mod4).\end{cases}

Our distribution result for O(p)\mathcal{O}(p) also has a direct application to the determination of the optimal size of conflict-avoiding codes of prime length. If O(p)>0\mathcal{O}(p) > 0, then

Me(p)≤M(p)≤Me(p)+⌊O(p)3⌋,(3)M^{e}(p)\leq M(p)\leq M^{e}(p)+\left\lfloor\frac{\mathcal{O}(p)}{3}\right\rfloor, \tag{3}

as will be explained in Section 3. A result of Hsia, Li and Sun [17] shows that the upper bound is attained when the index O(p)\mathcal{O}(p) is an odd prime. Combining their result with Theorem 2 gives the following consequence.

Theorem 4. Let p be an odd prime such that O(p)\mathcal{O}(p) is an odd prime. Then the upper bound in (3) is attained, and hence

M(p)=Me(p)+⌊O(p)3⌋=p−14−O(p)2+⌊O(p)3⌋.M(p)=M^{e}(p)+\left\lfloor\frac{\mathcal{O}(p)}{3}\right\rfloor=\frac{p-1}{4}-\frac{\mathcal{O}(p)}{2}+\left\lfloor\frac{\mathcal{O}(p)}{3}\right\rfloor.

Moreover, assuming GRH, the set of such primes has relative density 0.508822711238 ... within the set of odd primes p satisfying O(p)>2\mathcal{O}(p) > 2.

KARTHICK BABU, MOREE, PASUPULATI, AND SGOBBA

1.3.2. Result on the distribution of O(n)\mathcal{O}(n) for integer nn. Given any integer e≥0e \geq 0, one can wonder if there are nn with O(n)=e\mathcal{O}(n) = e and if they exist, how frequent they are. The following result gives a partial answer (for a proof see Section 9).

Theorem 5. For x≥3x \geq 3 and e≥0e \geq 0, let

Ne(x):=#{1<m≤x:m  odd  and  O(m)=e}.N_{e}(x):=\#\{1<m\leq x:m\;o d d\;a n d\;\mathcal{O}(m)=e\}.

We have

N0(x)=C0x(log⁡x)7/12+O(x(log⁡log⁡x)5(log⁡x)19/12),N_{0}(x)=C_{0}\frac{x}{(\log x)^{7/12}}+O\Big(\frac{x(\log\log x)^{5}}{(\log x)^{19/12}}\Big),

with

C0=1Γ(512)lim⁡t→∞∏p≤tg(p)(1−1p)512=0.32235⋯ ,C_{0}=\frac{1}{\Gamma(\frac{5}{12})}\lim_{t\to\infty}\prod_{p\leq t}g(p)\Big(1-\frac{1}{p}\Big)^{\frac{5}{12}}=0.32235\cdots,

and g(p)=(1−1/p)−1g(p) = (1 - 1/p)^{-1} if 2∣ordp(4)2 \mid \text{ord}_p(4) and g(p)=1g(p) = 1 otherwise. For every fixed e≥1e \geq 1 and for sufficiently large xx, we have

Ne(x)≫ex(log⁡x)7/12.N_{e}(x)\gg_{e}\frac{x}{(\log x)^{7/12}}.

Using Artin primitive root techniques one can say rather more in case e≥1e \geq 1. We hope to come back to this issue in a future publication.

1.4. Organization of the paper. Sections 2–4 develop order-theoretic, graph-theoretic, polynomial, and orbit-counting descriptions of O(n)\mathcal{O}(n), recovering several earlier results along the way. Section 5 introduces the near-primitive-root framework and some preliminary density computations. Section 6 applies these tools to prove Theorem 2. Section 7 studies the distribution of O(p)\mathcal{O}(p) in arithmetic progressions and proves Theorem 3. Section 8 considers prime values of O(p)\mathcal{O}(p) and proves Theorem 4, while Section 9 treats the distribution of O(n)\mathcal{O}(n) over odd integers and proves Theorem 5. Finally, Section 10 proves Theorem 1.