## 1 Introduction

A strongly regular graph (SRG) is a regular graph such that the number of common neighbors of two distinct vertices depends only on whether these vertices are adjacent or not. They arise in a lot of applications, see e.g. [8]. As first observed in [14], there is a strong link to projective two-weight codes, see [11] for a survey. The notion of SRGs has been generalized to distance-regular graphs or association schemes. Noting that the number of common neighbors of two vertices equals the number of walks of length two between them, strongly walk-regular graphs (SWRG) were introduced in [32]. A graph is an $$s$$-SWRG if the number of walks of length $$s$$ from a vertex to another vertex depends only on whether the two vertices are the same, adjacent, or not adjacent. Note that SRGs are s-SWRGs for all $$s>1$$. In [32, Theorem 3.4] it is shown that the adjacency matrix of a SWRG has at most four distinct eigenvalues and the following characterization of SWRGs is given.

### Lemma 1.1

(van Dam, Omidi [32, Proposition 4.1]) Let $$\Gamma$$ be a k-regular graph with four distinct eigenvalues $$k>\theta _1>\theta _2>\theta _3$$. Then $$\Gamma$$ is an $$s$$-SWRG for $$s\ge 3$$ if and only if

\begin{aligned} (\theta _2-\theta _3)\theta _1^{s}+(\theta _3-\theta _1)\theta _2^{s}+(\theta _1-\theta _2)\theta _3^{s}=0. \end{aligned}
(1)

Moreover, it is known that $$s$$ has to be odd. All known examples for $$s$$-SWRGs with $$s>3$$ satisfy $$\theta _2=0$$ and $$\theta _3=-\theta _1$$, where Eq. (1) is automatically satisfied for all odd $$s\ge 3$$.

Mimicking the mentioned link between SRGs and projective two-weight codes, a construction of SRWGs as coset graphs of the duals of projective three-weight codes was given recently in [27]. The eigenvalues of such graphs are integral and depend on the weights of the three-weight code, so that Eq. (1) turns into a number theory question. In [27], a construction of SWRGs from triple sum sets (TSS) is given.

Several research papers consider the feasible parameters of SRGs, see e.g. [6] for a large table together with references summarizing the state of knowledge. We remark that the smallest cases, where the existence or non-existence of a SRG is unclear, consist of 65 or 69 vertices. The corresponding parameters cannot be attained by two-weight codes since these always give graphs where the number of vertices is a power of the field size. Still, the existence of projective two-weight codes is an important source for the construction of SRGs, see e.g. [21], where several new examples have been found. An online database of known two-weight codes can be found at [12]. Due to a result of Delsarte [14, Corollary 2] the possible weights of two-weight codes are quite restricted, see Lemma 2.2.

Given the relation between the weights of a projective three-weight code and the eigenvalues of the coset graph of its dual, corresponding solutions of Eq. (1) can be easily enumerated. However, not all cases are feasible, i.e., attainable by a projective three-weight code. The aim of this paper is to study feasibility for the smallest cases. For binary codes we give results for lengths smaller than 72 and for ternary codes for lengths up to 39. Within that range only very few cases are left as open problems. This extends and corrects first enumeration results from [27]. Similar results for some special rings instead of finite fields are obtained in [26].

The remaining part of this paper is organized as follows. The necessary preliminaries are introduced in Sect. 2 followed by the enumeration results in Sect. 3. In Sect. 4 it is shown that for $$s=5$$ and $$s=7$$ the only rational solutions of Eq. (1) are given by the parametric solution $$\theta _2=0$$, $$\theta _3=-\theta _1$$. For $$s = 5$$, this reduces to the determination of the set of rational points on an elliptic curve and for $$s = 7$$, it leads to a curve of genus 2.

The computational results from Sect. 3 for the case $$q=2$$ suggest that projective three-weight codes of length n whose weights satisfy $$w_1+w_2+w_3=3n/2$$ possess a high divisibility of the weights and the length by powers of two. In Sect. 5 this is shown, see Lemma 5.11 and the following theorems for the details. In Appendix A we collect generator matrices for the mentioned feasible parameters from Sect. 3.

## 2 Preliminaries

In this article, $$q\ge 2$$ will always be the power of some prime p.

A linear q-ary code C of length n and dimension k is called an $$[n,k]_q$$ code. The number of positions which are not all-zero is called the effective length of C. If the length equals the effective length, C is called full-length. Two positions $$i,j\in \{1,\ldots ,n\}$$ of C are called projectively equivalent if there is a $$\lambda \in \mathbb {F}_q^*$$ with $$c_i = \lambda c_j$$ for all codewords $$c\in C$$. The code C is called projective if it is full-length and there are no projectively equivalent positions. For a general full-length code, the position multiplicity type is the sequence $$(m_i)$$ where $$m_i$$ denotes the number of projective equivalence classes of size i.

### 2.1 Restrictions on the weights

If there is only a single non-zero weight, C is called a constant weight code. The linear constant weight codes are completely classified.

### Lemma 2.1

(Bonisoli [2]) Let C be a full-length $$[n,k]_q$$ code of constant weight w of dimension $$k\ge 1$$. Then $$q^{k-1} \mid w$$, and C is isomorphic to the u-fold repetition of the q-ary simplex code $${{\,\textrm{Sim}\,}}_q(k)$$ of dimension k with $$u = w / q^{k-1}$$. In particular, $$n = u \cdot \frac{q^k - 1}{q-1}$$.

If C has exactly two different non-zero weights, C is called a two-weight code.

### Lemma 2.2

(Delsarte [14, Corollary 2]) Let C be a projective two-weight code over $$\mathbb {F}_q$$, where $$q=p^e$$ for some prime p. Then there exist suitable integers u and t with $$u\ge 1$$, $$t\ge 0$$ such that the weights are given by $$w_1=up^t$$ and $$w_2=(u+1)p^t$$.

If C has exactly three different non-zero weights, C is called a three-weight code. Furthermore, C is called $$\Delta$$-divisible for some integer $$\Delta \ge 1$$ if all weights of C are divisible by $$\Delta$$.

### Lemma 2.3

Let C be a linear projective $$[n,k]_q$$ three-weight code. Then $$n \le \frac{q^k-1}{q-1} - 2$$.

### Proof

Let G be a generator matrix of C. Since C is projective, G neither has a zero column, nor a pair of projectively equivalent columns. So each of the $$\frac{q^k-1}{q-1}$$ projective equivalence classes of non-zero vectors in $$\mathbb {F}_q^k$$ appears at most once as a column of G, showing that $$n \le \frac{q^k-1}{q-1}$$. In the case $$n = \frac{q^k-1}{q-1}$$, C is the simplex code $${{\,\textrm{Sim}\,}}_q(k)$$ of dimension k over $$\mathbb {F}_q$$, which is a code of constant weight $$q^{k-1}$$. In the case $$n = \frac{q^k-1}{q-1} - 1$$, C is the simplex code $${{\,\textrm{Sim}\,}}_q(k)$$ punctured in a single position, so C has only the two weights $$q^{k-1}$$ and $$q^{k-1}-1$$.Footnote 1 This contradicts the assumption that C is a three-weight code. $$\square$$

### 2.2 Weight enumerators and the MacWilliams identity

The weight distribution of C is the sequence of numbers $$(A_i)$$ where $$A_i$$ denotes the number of codewords of weight i. It can also be denoted as $$(0^{A_0} 1^{A_1} 2^{A_2} \ldots )$$, where entries with $$A_i = 0$$ may be omitted. The weight distribution is often given in polynomial form as the (univariate) weight enumerator $$W_C(x) = \sum _i A_i x^i$$ or the homogeneous weight enumerator $$W_C(x,y) = \sum _i A_i x^{n-i} y^i$$.

The weight distribution of the dual code $$C^\perp$$ will be denoted by $$(B_i)$$. We always have $$A_0 = B_0 = 1$$. Furthermore, $$B_0 = 0$$ if and only if C is full-length and $$B_0 = B_1 = 0$$ if and only C is projective. For the number $$B_2$$ of general full-length codes, the following statement can be checked.

### Lemma 2.4

Let C be a full-length q-ary linear code of length n and $$(m_i)$$ the position multiplicity type of C. Then

\begin{aligned} \sum _i i m_i&= n \quad \text {and} \\ \sum _i (q-1) \left( {\begin{array}{c}i\\ 2\end{array}}\right) m_i&= B_2 \end{aligned}

The weight distributions of C and $$C^\perp$$ are related via the MacWilliams identities [24]

\begin{aligned} \sum _{j=0}^{n-\nu } {{n-j}\atopwithdelims ()\nu } A_j=q^{k-\nu }\cdot \sum _{j=0}^\nu {{n-j}\atopwithdelims (){n-\nu }}B_j\quad \text {for }0\le \nu \le n\text {.} \end{aligned}
(2)

or in homogeneous polynomial form as

\begin{aligned} W_{C^\perp }(x,y) = \frac{1}{\#C} \cdot W_C(x + (q-1) y, x - y)\text {.} \end{aligned}

In fact, the $$B_i$$ are uniquely determined by the $$A_i$$, as can be seen by the following variant of the MacWilliams identities. Based on the i-th q-ary Krawtchouk polynomial

\begin{aligned} K_i(x) = \sum _{\nu =0}^i (-1)^\nu \left( {\begin{array}{c}x\\ \nu \end{array}}\right) \left( {\begin{array}{c}n-x\\ i-\nu \end{array}}\right) (q-1)^{i-\nu }\text {,} \end{aligned}

we have

\begin{aligned} B_i = \frac{1}{\#C} \cdot \sum _{j = 0}^n K_i(j) A_j\text {.} \end{aligned}

For a binary projective $$[n,k]_2$$ code, the system of the four equations with $$i\in \{0,1,2,3\}$$ can be rewritten to

\begin{aligned} \sum _{i>0} A_i= & {} 2^k-1, \end{aligned}
(3)
\begin{aligned} \sum _{i\ge 0} iA_i= & {} 2^{k-1}n, \end{aligned}
(4)
\begin{aligned} \sum _{i\ge 0} i^2A_i= & {} 2^{k-2}\cdot n(n+1), \end{aligned}
(5)
\begin{aligned} \sum _{i\ge 0} i^3A_i= & {} 2^{k-3}\cdot (n^2(n+3)-6B_3). \end{aligned}
(6)

In this special form of the left hand side, they are also called the first four (Pless) power moments, see [25]. Given the length n, the dimension k, and the weights $$w_1,w_2,w_3$$ of a projective three-weight code, we can compute $$A_{w_i}$$ and $$B_3$$:

\begin{aligned} A_{w_1}= & {} \frac{2^{k-2}\cdot \left( n^2 - 2nw_2 - 2nw_3 + 4w_2w_3 + n\right) - w_2w_3}{(w_2-w_1)(w_3-w_1)} \end{aligned}
(7)
\begin{aligned} A_{w_2}= & {} \frac{2^{k-2}\cdot \left( n^2 - 2nw_1 - 2nw_3 + 4w_1w_3 + n\right) - w_1w_3}{(w_2-w_3)(w_2-w_1)} \end{aligned}
(8)
\begin{aligned} A_{w_3}= & {} \frac{2^{k-2}\cdot \left( n^2 - 2nw_1 - 2nw_2 + 4w_1w_2 + n\right) - w_1w_2}{(w_3-w_1)(w_3-w_2)} \end{aligned}
(9)
\begin{aligned} 3B_3= & {} \frac{n^2(n+3)}{2}-\left( w_1+w_2+w_3\right) n(n+1) \nonumber \\{} & {} +2\left( w_1w_2+w_1w_3+w_2w_3\right) n-4w_1w_2w_3+w_1w_2w_3\cdot 2^{2-k} \end{aligned}
(10)

All $$A_j$$ except $$A_0=1$$ and $$A_{w_1}$$, $$A_{w_2}$$, $$A_{w_3}$$ are equal to zero, so that the $$B_i$$ with $$i\ge 4$$ are uniquely determined using the remaining MacWilliams identities, i.e., those for $$\nu \ge 4$$. Note that (10) implies that the product $$w_1w_2w_3$$ has to be divisible by $$2^{k-2}$$. We remark that we will obtain stronger divisibility conditions in Sect. 5. Of course, similar explicit expressions can also be determined for field sizes $$q>2$$. However, we will mostly restrict our theoretical considerations to $$q=2$$ in the remaining part of the paper.

For a linear $$[n_1,k_1]_q$$ code $$C_1$$ and a linear $$[n_2,k_2]_q$$ code $$C_2$$, the direct sum of $$C_1$$ and $$C_2$$ is defined as

\begin{aligned} C_1 \oplus C_2 = \{ (c_1, c_2) \mid c_1\in C_1, c_2\in C_2\}\text {.} \end{aligned}

It is a linear $$[n_1 + n_2, k_1 + k_2]_q$$ code. Its weight enumerator is given by

\begin{aligned} W_{C_1 \oplus C_2}(x) = W_{C_1}(x) \cdot W_{C_2}(x)\text {.} \end{aligned}

### 2.3 The coset graph triple sum sets

A coset of a linear code C is any translate of C by a constant vector. A coset leader of a fixed coset is any element that minimizes the weight. The weight of a coset is the weight of any of its coset leaders. With this, the coset graph $$\Gamma _C$$ of a linear code C is defined on the cosets of C as vertices, where two cosets are connected iff they differ by a coset of weight one. To ease notation, we speak of the eigenvalues of a graph $$\Gamma$$ meaning the eigenvalues of the corresponding adjacency matrix. For a projective code C the eigenvalues of the coset graph $$\Gamma _{C^\perp }$$ of its dual code are completely determined by the occurring non-zero weights $$w_i$$ of C, see [7, Theorem 1.11.1]:

### Theorem 2.5

Let C be a projective $$[n,k]_q$$ code with distinct weights $$w_0=0,w_1$$, $$\dots$$, $$w_r$$. Then, the coset graph $$\Gamma _{C^\perp }$$ of its dual code $$C^\perp$$ is $$n(q-1)$$-regular and the eigenvalues are given by $$n(q-1)-qw_i$$ for $$i\in \{0,\ldots ,r\}$$.

Triple sum sets (TSS) have been introduced in [13] as generalization of partial difference sets. A set $$\Omega \subseteq {\mathbb {F}}_q^k$$ is called a triple sum set if it is closed under scalar multiplication and there are constants $$\sigma _0$$ and $$\sigma _1$$ such that each non-zero $$h\in {\mathbb {F}}_q^k$$ can be written as $$h=x+y+z$$ with $$x,y,z\in \Omega$$ exactly $$\sigma _0$$ times if $$h\in \Omega$$ and $$\sigma _1$$ times if $$h\in {\mathbb {F}}_q^k\backslash \Omega$$.

If $$\Omega \subseteq {\mathbb {F}}_q^k$$ and $$0\notin \Omega$$, then we denote by $$C(\Omega )$$ the projective code of length $$n=\#\Omega /(q-1)$$ obtained as the kernel of the $$k\times n$$ matrix H whose columns are the projectively non-equivalent elements of $$\Omega$$. Thus, H is the parity check matrix of the linear code $$C(\Omega )$$. In order to ease the notation, we abbreviate $$\Gamma _{C(\Omega )}$$ as $$\Gamma (\Omega )$$. In [27, Theorem 2] it was shown that $$\Omega$$ is a TSS if and only if $$\Gamma (\Omega )$$ is a 3-SWRG. (Actually, [27, Theorem 2] states the equivalence of $$\Gamma (\Omega )$$ being an s-SWRG and $$\Omega$$ being an s-sum set, where the element h in the definition of a TSS is a sum of s elements from $$\Omega$$.)

### Lemma 2.6

Let $$s\ge 2$$ be an integer. The following equation holds for all $$\theta _1$$, $$\theta _2$$, $$\theta _3$$ over any commutative ring:

\begin{aligned}{} & {} (\theta _2-\theta _3)\theta _1^{s}+(\theta _3-\theta _1)\theta _2^{s}+(\theta _1-\theta _2)\theta _3^{s}\nonumber \\{} & {} =(\theta _1-\theta _2)(\theta _1-\theta _3)(\theta _2-\theta _3)\cdot \!\!\!\!\sum _{h+i+j=s-2} \theta _1^h\theta _2^i\theta _3^j\,. \end{aligned}
(11)

A coding-theoretic characterization of triple sum sets is given as follows, see [13, Theorem 2.1] or [27, Theorem 5].

### Theorem 2.7

If $$\Omega \subseteq {\mathbb {F}}_q^k$$ so that $$C(\Omega )^\perp$$ has length n and attains exactly three non-zero weights $$w_1$$, $$w_2$$, and $$w_3$$, then $$\Omega$$ is a TSS iff $$w_1+w_2+w_3=\frac{3n(q-1)}{q}$$.

### Proof

Using Eq. (11) from Lemma 2.6 for $$s=3$$, (1) becomes

\begin{aligned} (\theta _1-\theta _2)(\theta _1-\theta _3)(\theta _2-\theta _3)(\theta _1 + \theta _2 + \theta _3) = 0\,. \end{aligned}

Theorem 2.5 shows that the eigenvalues are pairwise different and we conclude that (1) is satisfied iff $$\theta _1+\theta _2+\theta _3=0$$. Plugging in the formula for the eigenvalues from Theorem 2.5 gives the condition $$w_1+w_2+w_3=\frac{3n(q-1)}{q}$$. $$\square$$

As mentioned in the introduction, all known examples for $$s$$-SWRGs satisfy $$\theta _2=0$$ and $$\theta _3=-\theta _1$$, i.e., they are s-SWRGs for all odd $$s\ge 3$$. So, starting from projective three-weight codes to construct SWRGs it is sufficient to study those that satisfy the weight constraint $$w_1+w_2+w_3=3n(q-1)/q$$. We do so in Sect. 3. We would like to point out that there are (many) binary projective three-weight codes with $$w_1 + w_2 + w_3 \ne 3n(q-1)/q$$. As an example, consider the binary $$[6,5]_2$$ parity check code. It is a projective three-weight-code with weight distribution is $$(0^1 2^{15} 4^{15} 6^1)$$. The sum of its weights is 12, but $$\frac{3}{2} n = 9$$.

### 2.4 The geometric point of view to linear codes

For a vector space V, let $$\genfrac[]{0.0pt}{}{V}{k}_{q}$$ be the set of all subspaces of dimension k. If V is of finite dimension v, $$\#\genfrac[]{0.0pt}{}{V}{k}_{q}$$ equals the Gaussian binomial coefficient $$\genfrac[]{0.0pt}{}{v}{k}_{q}$$. Conveniently, we will identify a vector space V with the set $$\genfrac[]{0.0pt}{}{V}{1}_{q}$$ of points contained in V.

A multiset on a base set S is a mapping $$M : S \rightarrow {\mathbb {Z}}_{\ge 0}$$, assigning a multiplicity to each element in S. For $$T \subseteq S$$, we set $$M(T) = \sum _{s\in T}M(s)$$. The cardinality of M is $$\#M = M(S)$$, which is the sum of the multiplicities of all elements. In enumerative form, a multiset may be written by statements of the form $$M = \{\!\{ s_1, s_2, \ldots , s_n\}\!\}$$, with the obvious interpretation. If N is a multiset on a base set T and $$\phi$$ is a predicate on T, we may also use multiset-builder notations like $$M = \{\!\{t\in N \mid \phi (t)\}\!\}$$.

We will make use of the geometric description of linear codes as in [16]. There is a bijective correspondence of (semi-)linear equivalence classes of linear full-length $$[n,k]_q$$-codes C and (semi-)linear equivalence classes of spanning multisets $${\mathcal {C}}$$ of n points in $${{\,\textrm{PG}\,}}(V) \cong {{\,\textrm{PG}\,}}(k-1,q)$$, where V is a $$\mathbb {F}_q$$-vector space of dimension k. For a concrete assignment, let G be a generator matrix of C and $$v_1,\ldots ,v_n$$ the columns of G and consider the multiset $${\mathcal {C}} = \{\!\{\langle v_1\rangle ,\ldots ,\langle v_n\rangle \}\!\}$$ of points in $$V = \mathbb {F}_q^k$$. In this way, a codeword $$c = xG$$ is represented by the hyperplane $$H = x^\perp$$ (in fact, H represents all the $$q-1$$ codewords which are projectively equivalent to c). The weight of c has a natural geometric description, namely $$w(c) = n - {\mathcal {C}}(H)$$, where the hyperplane H is identified with the set of points contained in H. In other words, w(c) is the number of points in $${\mathcal {C}}$$, counted with multiplicity, which are not contained in H. The code C is projective if and only if $${\mathcal {C}}$$ is a proper set.

The following codes have an easy geometric description:

1. (i)

The q-ary simplex code $${{\,\textrm{Sim}\,}}_q(k)$$ of dimension $$k\ge 1$$ corresponds to the set of all points contained in a vector space of (algebraic) dimension k. It is a projective linear $$[(q^k-1)/(q-1), k]_q$$ constant code weight code with weight enumerator $$W_{{{\,\textrm{Sim}\,}}_q(k)}(x) = 1 + (q^k-1)x^{q^{k-1}}$$.

2. (ii)

The q-ary first order Reed-Muller code $${{\,\textrm{RM}\,}}_q(k)$$ of dimension $$k\ge 2$$ corresponds to an affine subspace of dimension $$k-1$$, that is the set of points contained in $$A = V \setminus W$$, where V is an $$\mathbb {F}_q$$-vector space of dimension k and W is a subspace of codimension 1. It is a projective linear $$[q^{k-1}, k]_q$$ two-weight code with weight enumerator $$W_{{{\,\textrm{RM}\,}}_q(k)}(x) = 1 + (q^k-q)x^{(q-1)q^{k-2}} + (q-1) x^{q^{k-1}}$$. In the geometric description, the space W is known as the hyperplane at infinity of A. It corresponds to the $$q-1$$ codewords of weight $$q^{k-1}$$.

For a fixed point P in V, we consider the standard projection $$\pi _P : V \rightarrow V/P, x \mapsto x + P$$. It is extended to the multiset $${\mathcal {C}}$$ of points as

\begin{aligned} \pi _P({\mathcal {C}}) = \{\!\{ \pi _P(Q) \mid Q\in {\mathcal {C}} \text { with }Q \ne P\}\!\}\text {.} \end{aligned}

We have $$\#\pi _P({\mathcal {C}}) = \#{\mathcal {C}} - {\mathcal {C}}(P)$$.

The projections $$\pi _P({\mathcal {C}})$$ with $$P\in \genfrac[]{0.0pt}{}{V}{1}_{q}$$ correspond to the subcodes $$C'$$ of C of codimension one. A codeword $$c\in C$$ with corresponding hyperplane $$H < V$$ is contained in $$C'$$ if and only if $$P \in H$$.

Let C be a projective $$[n,k]_q$$-code with weight enumerator $$W_C(x) = \sum _i A_i x^i$$ and $${\mathcal {C}}$$ a corresponding point set. If the complement $${\mathcal {C}}^\complement = \genfrac[]{0.0pt}{}{\mathbb {F}_q^k}{1}_{q} \setminus {\mathcal {C}}$$ is spanning (or equivalently, $$A_{q^{k-1}} = 0$$), we call its corresponding $$[\frac{q^k-1}{q-1}-n,k]_q$$-code $$C^\complement$$ the anticode of C. In this way, the anticode of C is defined up to isomorphism. Its weight enumerator is $$W_{C^\complement }(x) = 1 + \sum _{i > 0} A_{q^{k-1} - i} x^i$$.

## 3 Feasible parameters of projective three-weight codes satisfying $$\mathbf {w_1+w_2+w_3=3n(q-1)/q}$$

As outlined in Sect. 2 we can construct 3-SWRGs from projective $$[n,k]_q$$ three-weight codes if the weights satisfy $$w_1+w_2+w_3=3n(q-1)/q$$. So, here we study the feasible sets of parameters $$n,k,w_1,w_2,w_3$$ such that a corresponding projective three-weight code exists. In Sect. 3.1 we consider the admissible parameters for all lengths $$n<72$$ in the binary case and in Sect. 3.2 we consider the admissible parameters for all lengths $$n\le 39$$ in the ternary case.

In that range we can simply loop over all weight-triples $$(w_1, w_2, w_3)$$ with $$1 \le w_1< w_2 < w_3 \le n$$ satisfying $$w_1+w_2+w_3=3n(q-1)/q$$. For $$q=2$$, (10) implies that the product $$w_1w_2w_3$$ is divisible by $$2^{k-2}$$, which restricts the possible choices for the dimension k. For $$q=3$$ we may use the trivial bounds $$1\le k\le n$$. Then, the MacWilliams identities uniquely determine the values of all $$A_i$$s and $$B_i$$s. As a first check we test if all of these values are non-negative integers. As a consequence of [33, Theorem 1], any full-length $$\Delta$$-divisible $$[n,k]_q$$ code is the $$\Delta /\gcd (\Delta ,q^{k-1})$$-fold repetition of some code. As projectivity forbids proper repetitions, we can restrict ourselves to the cases where $$\gcd (\Delta ,q^{k-1}) = \gcd (w_1, w_2, w_3, q)$$ is a power of p. Examples where we can apply this criterion to exclude the existence of codes are $$q=2$$, $$n=36$$, $$(w_1,w_2,w_3)=(12,18,24)$$, and $$k\in \{6,7,8\}$$. The corresponding values of $$(A_{w_1}, A_{w_2},A_{w_3})$$ are (2, 56, 5), (10, 104, 13), and (26, 200, 29). For $$q=3$$, this criterion can be applied to the parameters $$n=24$$, $$k=4$$ and weight triple $$w=(14,16,18)$$ as well as $$n=36$$, $$k\in \{5,6\}$$ and weight triple $$w=(18, 24, 30)$$. In order to find examples, we have used the software package LinCode [4] to enumerate matching codes or tried to reduce the problem complexity by prescribing automorphisms and applying exact or heuristic solvers for the resulting integer linear programs.

Summarizing the above, we call parameters $$(q, n, k, w_1, w_2, w_3)$$ admissible if

1. (i)

$$1\le w_1<w_2<w_3\le n$$ and $$w_1+w_2+w_3=3n(q-1)/q$$ and

2. (ii)

$$\gcd (w_1,w_2,w_3,q)$$ is a power of p and

3. (iii)

$$w_1w_2w_3$$ is divisible by $$2^{k-2}$$ (if $$q=2$$) or $$1\le k\le n$$ (if $$q=3$$) and

4. (iv)

all $$A_i$$ and $$B_i$$ with $$i\in \{0,\ldots ,n\}$$ are non-negative integers and

5. (v)

$$B_1 = B_2 = 0$$.

### 3.1 Feasible parameters for projective binary three-weight codes with $$\mathbf {w_1+w_2+w_3=3n/2}$$

In Table 1 we list the admissible parameters for projective binary three-weight codes with $$w_1+w_2+w_3=3n/2$$. For each length $$4\le n<72$$ we list the admissible dimensions k, weight triples $$w=(w_1,w_2,w_3)$$, and the weight distribution in the form $$(A_{w_1},A_{w_2},A_{w_3})$$. The last column contains known results about the existence of codes with these parameters. For some cases we can state the number of isomorphism types of those codes. The 8-divisible $$[n,k]_2$$ codes with length at most 48 are classified in [1] and the projective codes are extracted in [18]. If not mentioned otherwise, the remaining complete classification results are obtained with the software package LinCode [4]. For the parameters marked with $$\ge 1$$ we constructed at least one code by prescribing an automorphism group, see [5].

We mark the non-existence results with the keyword “None” in the comment column of Table 1 and give a reference to the used method. One frequently showing up is the following.

### Lemma 3.1

([15, Proposition 5], cf. [28]) Let C be an $$[n,k,d]_2$$-code with all weights divisible by $$\Delta =2^a$$ and let $$\left( A_i\right) _{i=0,1,\dots ,n}$$ be the weight distribution of C. Put

\begin{aligned} \alpha:= & {} \min \{k-a-1,a+1\},\\ \beta:= & {} \lfloor (k-a+1)/2\rfloor ,\text { and}\\ \delta:= & {} \min \{2\Delta i\,\mid \,A_{2\Delta i }\ne 0\text { and } i>0\}. \end{aligned}

Then the integer

\begin{aligned} T:=\sum _{i=0}^{\lfloor n/(2\Delta )\rfloor } A_{2\Delta i} \end{aligned}

satisfies the following conditions.

1. (i)

T is divisible by $$2^{\lfloor (k-1)/(a+1)\rfloor }$$.

2. (ii)

If $$T<2^{k-a}$$, then

\begin{aligned} T=2^{k-a}-2^{k-a-t} \end{aligned}

for some integer t satisfying $$1\le t\le \max \{\alpha ,\beta \}$$. Moreover, if $$t>\beta$$, then C has an $$[n,k-a-2,\delta ]_2$$-subcode and if $$t\le \beta$$, it has an $$[n,k-a-t,\delta ]_2$$-subcode.

3. (iii)

If $$T>2^k-2^{k-a}$$, then

\begin{aligned} T=2^k-2^{k-a}+2^{k-a-t} \end{aligned}

for some integer t satisfying $$0\le t\le \max \{\alpha ,\beta \}$$. Moreover, if $$a=1$$, then C has an $$[n,k-t,\delta ]_2$$ subcode. If $$a>1$$, then C has an $$[n,k-1,\delta ]_2$$ subcode unless $$t=a+1\le k-a-1$$, in which case it has an $$[n,k-2,\delta ]_2$$ subcode.

A special and well-known subcase of Lemma 3.1 is that the number of even weight codewords in a $$[n,k]_2$$ code is either $$2^{k-1}$$ or $$2^k$$, see Lemma 5.1. As an example, for $$n=32$$, $$k=10$$, and weight triple $$w=(8, 16, 24)$$ we obtain $$(A_{w_1},A_{w_2},A_{w_3}) = (61,899,63)$$. Applying Lemma 3.1 gives $$\Delta =8$$, $$a=3$$, $$\alpha =4$$, $$\beta =4$$, $$\delta =16$$, and $$T=900$$. As required by Part (i), T is divisible by 4. However, Part (iii) gives $$t=5$$, which contradicts $$0\le t\le \max \{\alpha ,\beta \}$$, so that a code cannot exist.

Bounds for the largest possible minimum distance for given length and dimension are well studied in the literature, see e.g. the online tables [17]. For length $$n=64$$ and dimension $$k=11$$ the largest possible minimum distance is known to be either 26 or 27, which rules out the existence of a projective code with weight triple $$w=(28, 32, 36)$$. We use the comment “codetables” in this case. For $$n=64$$ and $$w=(24, 32, 40)$$ we use a classification result from [19], i.e., every 13-dimensional 8-divisible binary linear code with non-zero weights in $$\{24,32,40,56,64\}$$ has to contain a codeword of weight 64. Anticipating the results from Sect. 5 we also apply Corollary 5.7, which shows that the length n has to be divisible by 4. The case $$n=58$$ is excluded by that criterion. For length $$n=64$$ and weight triple $$w=(16,32,48)$$, the dimension can be at most 11 by Theorem 3.2. Just four cases remain undecided. They occur for length $$n\in \{40,48,56,64\}$$ and are marked by “Open”. For each feasible case we give a suitable generator matrix as an example in Appendix A.

Based on [23, Thm. 4] (for the projective case an alternative proof is found in [20, Sec. 4]), we derive the following classification result on three-weight codes.

### Theorem 3.2

Let $$\Delta = 2^a$$ with $$a\ge 3$$ an integer and let C be a full-length $$[n,k]_2$$ three-weight code with the non-zero weights $$\Delta$$, $$2\Delta$$ and $$3\Delta$$ and length $$3\Delta \le n \le 4\Delta$$. Then $$k \le 2a+3$$. In the case of equality, we have that $$n \in \{4\Delta - 1, 4\Delta \}$$, C is projective and falls into one of the following two cases.

1. (i)

For $$n = 4\Delta - 1$$, C is isomorphic to the direct sum of the binary simplex code of dimension $$a+1$$ and the binary first order Reed-Muller code of dimension $$a+2$$. The weight enumerator of C is

\begin{aligned} W_C(x) = 1 + (6\Delta - 3) x^{\Delta } + (8\Delta ^2 - 8 \Delta + 3) x^{2\Delta } + (2\Delta - 1) x^{3\Delta }\text {.} \end{aligned}
2. (ii)

For $$n = 4\Delta$$, C is isomorphic to the code with the generator matrix

where

\begin{aligned} \begin{pmatrix} &{} &{} \\ &{} R_{a+2} &{} \\ 1 &{} \cdots &{} 1 \end{pmatrix} \in \mathbb {F}_2^{(a+2) \times 2\Delta } \end{aligned}

denotes a generator matrix of the binary first order Reed-Muller code of dimension $$a+2$$, such that the all-one word is the last row of the generator matrix. The weight enumerator of C is

\begin{aligned} W_C(x) = 1 + (4\Delta - 3) x^{\Delta } + (8\Delta ^2 - 8 \Delta + 3) x^{2\Delta } + (4\Delta - 1) x^{3\Delta }\text {.} \end{aligned}

### Proof

After appending zero positions, we may consider C as a code of length $$4\Delta$$. Let $${\textbf{1}}$$ be the all-one word of length $$4\Delta$$. The code $${\bar{C}} = C + \langle {\textbf{1}} \rangle$$ is a $$\Delta$$-divisible binary linear code of effective length $$4\Delta$$ containing the all-one word $${\textbf{1}}$$. By [23, Thm. 4], $$\dim ({\bar{C}}) \le 2a + 4$$, and in the case of equality we may assume $${\bar{C}} = {{\,\textrm{RM}\,}}_2(a+2) \oplus {{\,\textrm{RM}\,}}_2(a+2)$$, up to isomorphism. So $$k = \dim (C) \le 2a + 3$$, and in the case of equality, C is a codimension 1 subcode of $${\bar{C}}$$ not containing $${\textbf{1}}$$.

We switch to the geometric description of linear codes. The corresponding point set of $${\bar{C}} = {{\,\textrm{RM}\,}}_2(a+2) \oplus {{\,\textrm{RM}\,}}_2(a+2)$$ has the form $$\bar{{\mathcal {C}}} = A_1 \cup A_2$$ with $$A_1 = V_1 \setminus W_1$$ and $$A_2 = V_2 \setminus W_2$$, where $$V_1$$ and $$V_2$$ are vector spaces over $$\mathbb {F}_2$$ of dimension $$a+2$$ having trivial intersection, and $$W_1 < V_1$$, $$W_2 < V_2$$ are codimension 1 subspaces.Footnote 2 The ambient vector space is $$V = V_1 \oplus V_2$$. The codeword $${\textbf{1}}\in {\bar{C}}$$ corresponds to a hyperplane $$H_0$$ of V not containing any point of $$\bar{{\mathcal {C}}}$$. By the dimension formula, $$\dim (H_0 \cap V_1) \ge a+1$$, which forces $$H_0 \cap V_1 = W_1$$. In the same way, $$H_0 \cap V_2 = W_2$$ and therefore, $$W_1 + W_2 < H_0$$. Since $$W_1 + W_2$$ has codimension 2 in V, there are only $$\genfrac[]{0.0pt}{}{2}{1}_{2} = 3$$ hyperplanes of V containing $$W_1 + W_2$$. Two of these are $$V_1 + W_2$$ and $$W_1 + V_2$$ which do contain points of $$\bar{{\mathcal {C}}}$$, so $$H_0$$ is the third one.

As C is a subcode of $${\bar{C}}$$ of codimension 1, a corresponding point set $${\mathcal {C}}$$ of C is given by the multiset image $$\pi _P(\bar{{\mathcal {C}}})$$ of the projection $$\pi _P : V \rightarrow V/P$$, $$x\mapsto x + P$$ with respect to a suitable point $$P\in \genfrac[]{0.0pt}{}{V}{1}_{q}$$. Since $${\textbf{1}} \notin C$$, we have that $$P \notin H_0$$, so P must be contained in one of the other two hyperplanes containing $$W_1 + W_2$$. Without restriction, we may assume $$P\in V_1 + W_2$$. Together with $$P\notin H_0$$, this implies $$P\in (V_1 + W_2) \setminus (W_1 + W_2)$$.

Case 1: $$P\in \bar{{\mathcal {C}}}$$, so $$P\in V_1 \setminus W_1$$. We get that $$\pi _P(A_1)$$ is the set of all points in a subspace of algebraic dimension $$a+1$$, $$\pi _P(A_2)$$ is again an affine subspace of dimension $$a+2$$, and $$\langle \pi _P(A_1)\rangle \cap \langle \pi _P(A_2)\rangle = \{{\textbf{0}}\}$$. Therefore, $$C \cong {{\,\textrm{Sim}\,}}_2(a+1) \oplus {{\,\textrm{RM}\,}}_2(a+2)$$. The weight enumerator is computed as $$W_C(x) = W_{{{\,\textrm{Sim}\,}}_2(a+1)}(x) \cdot W_{{{\,\textrm{RM}\,}}_2(a+2)}(x)$$.

Case 2: $$P\notin \bar{{\mathcal {C}}}$$, so $$P\in (V_1 + W_2) \setminus ((W_1 + W_2) \cup V_1)$$. A moment’s reflection shows that all these choices for P lead to equivalent point sets $$\bar{{\mathcal {C}}}$$. As P is not collinear with two different points of $$\bar{{\mathcal {C}}}$$, the projection $${\mathcal {C}}$$ with respect to P is a proper set and therefore, C is projective. So $${\mathcal {C}}$$ is the disjoint union of the two affine subspaces $$\pi _P(A_1)$$ and $$\pi _P(A_2)$$ of dimension $$a+1$$.

The dimension formula leads to $$\dim (\pi _P(V_1) \cap \pi _P(V_2)) = 1$$. There are unique points $$Q_1\in V_1\setminus W_1$$ and $$Q_2\in W_2$$ such that P is the third point on the line $$L = Q_1 + Q_2$$ The affine space $$\pi _P(A_2)$$ has the hyperplane at infinity $$(W_2 + P) / P$$, which contains the single point $$(Q_1 + P)/P = (Q_2 + P) / P = L/P$$ of the affine space $$\pi _P(A_1)$$. So the point $$\pi _P(V_1) \cap \pi _P(V_2) = L/P$$ is contained in $$\pi _P(A_1)$$ and in the hyperplane at infinity of $$\pi _P(A_2)$$. This leads to the generator matrix stated in the theorem.

By construction, the code corresponding to the point set $${\mathcal {C}}$$ is a projective $$[2^{a+1}, 2a+3]_2$$-code with (at most) the weights $$\Delta$$, $$2\Delta$$ and $$3\Delta$$. Equations (7), (8) and (9) evaluate to the stated weight enumerator of C. $$\square$$

Looking at the feasible cases in Table 1, we notice that all of them satisfy $$w_2=n/2$$, which corresponds to $$\theta _2=0$$, $$\theta _3=-\theta _1$$ for the eigenvalues of $$s$$-SWRGs, see Eq. (1). While we conjecture that all integral solutions of Eq. (1) satisfy this extra constraint for all $$s\ge 5$$, see Sect. 4, the condition $$\theta _1+\theta _2+\theta _3=0$$, i.e., $$w_1+w_2+w_3=3n(q-1)/q$$, is sufficient for $$s=3$$. So, it is an interesting open question, if 3-SWRGs obtained from the coset graph of the dual code of a projective three-weight code also have to satisfy this extra condition. To stimulate research into this direction we propose:

### Conjecture 3.3

Let C be a projective $$[n,k]_2$$ three-weight code with non-zero weights $$w_1< w_2 < w_3$$ satisfying $$w_1 + w_2 + w_3 = \tfrac{3n}{2}$$. Then $$w_2=\frac{n}{2}$$.

We remark that the MacWilliams identities, using the non-negativity and integrality constraints, are not sufficient to prove Conjecture 3.3. As an example, the values $$(n,w_1,w_2,w_3)\in \{(58,24, 31, 32), (68, 30, 32, 40)\}$$ go in line with these conditions for $$q=2$$ but are excluded with more sophisticated methods, see the details stated above. Given the results obtained so far we can state that Conjecture 3.3 is true for all $$n<72$$. The next case, where all non-negativity and integrality constraints for the $$B_i$$ are satisfied, is given by $$(n,w_1,w_2,w_3)=(100,46, 48, 56)$$. Here we have $$k=7$$, $$A_{w_1}=32$$, $$A_{w_2}=145$$, $$A_{w_3}=78$$, and $$B_3=580$$. However, we can apply Lemma 3.1 to conclude the non-existence of a binary linear code with these parameters. More precisely, Lemma 3.1.(iii), applied with $$a=1$$ and $$T=224$$, yields a contradiction since $$T-2^k+2^{k-a}=96$$ is not a power of two. In Table 2 we list all parameters $$\left( n,w_1,w_2,w_3,y=2^{k-2},A_1,A_2,A_3,B_3\right)$$ up to $$n=256$$, where all $$B_i$$ are integral and non-negative and also Lemma 3.1 does not yield a contradiction, i.e., the parameters of potential counterexamples to Conjecture 3.3.

### 3.2 Feasible parameters for projective ternary three-weight codes with $$\mathbf {w_1+w_2+w_3=2n}$$

In Table 3 we list the admissible parameters for projective ternary three-weight codes with $$w_1+w_2+w_3=2n$$. For each length $$3\le n\le 39$$ we list the admissible dimensions k and weight triples $$(w_1,w_2,w_3)$$, and the weight distribution in the form $$(A_{w_1},A_{w_2},A_{w_3})$$. The last column contains known results about the existence of codes with these parameters. For some cases we can also state the number of isomorphism types of those codes. If not mentioned otherwise, the classification results are obtained with the software package LinCode [4]. For the parameters marked with $$\ge 1$$ we constructed at least one code by prescribing an automorphism group, see [5].

We also list those non-existence results where more sophisticated methods are necessary. We mark the non-existence results with the keyword “None” in the comment column of Table 3 and give a reference to the used method.

For $$n=27$$, $$k=6$$, and weight triple (9, 18, 27) we have used exhaustive enumeration using LinCode to exclude the existence of the corresponding code. It would be nice to also have a theoretical argument. For $$36 \le n\le 39$$ four cases remain undecided, which we mark with the keyword “Open”. For each feasible case we give a suitable generator matrix in Appendix A.

Similar to Conjecture 3.3, the numerical data suggests the conjecture $$w_2 = \frac{2}{3} n$$. Based on our computational data, we dare to state the following q-ary version of Conjecture 3.3.

### Conjecture 3.4

Let C be a projective $$[n,k]_q$$ three-weight code with non-zero weights $$w_1<w_2<w_3$$ satisfying $$w_1+w_2+w_3=3 (1 - \frac{1}{q}) n$$. Then $$w_2=(1 - \frac{1}{q}) n$$. Moreover, $$w_1 = w_2 - t$$ and $$w_3 = w_2 + t$$, where t is a power of the characteristic p of $${\mathbb {F}}_q$$.

For $$q=2$$, Conjecture 3.4 follows from Conjecture 3.3 by Lemma 5.10. We further remark that the precondition $$w_1 + w_2 + w_3 = 3 (1 - \frac{1}{q}) n$$ cannot be dropped, as seen by the binary $$[7,4]_2$$ Hamming code, which is a three-weight code with weight distribution $$(0^1 3^3 4^3 7^1)$$.

## 4 Plane curves given by the sum of all monomials of given degree

In this section, we present some results on rational (or integral) solutions of the equation

\begin{aligned} \sum _{h+i+j = s-2} \theta _1^h \theta _2^i \theta _3^j = 0 \,, \end{aligned}
(12)

which for pairwise distinct $$\theta _1, \theta _2, \theta _3$$ is equivalent to (1) by Lemma 2.6. We restrict to the case that $$s$$ is odd. When $$s$$ is even, then there are no nontrivial real solutions, so a fortiori no rational solutions.

We denote by $$C_{s-2}$$ the plane projective curve defined by (12), and we will rename the variables $$\theta _1, \theta _2, \theta _3$$ in this section as xyz. As already mentioned, $$C_1$$ is the line $$x + y + z = 0$$, and there are many rational points on this curve. In general, it is not hard to see that $$C_d$$ is smooth over $$\mathbb {Q}$$, so the curve is in particular geometrically irreducible and has genus $$g(C_d) = (d-1)(d-2)/2$$.

For $$d = 3$$ (corresponding to $$s= 5$$), $$C_3$$ is a curve of genus 1 with some rational points, so it is an elliptic curve. A standard procedure (implemented, for example, in Magma [3]) produces an isomorphic curve in Weierstrass form. It turns out that $$C_3$$ is isomorphic to the curve with label 50a1 in the Cremona database (http://www.lmfdb.org/EllipticCurve/Q/50/a/350.a3 in the LMFDB [30]). In Cremona’s tables or under the link above, one can check that this curve has exactly three rational points. This proves the following.

### Lemma 4.1

\begin{aligned} C_3(\mathbb {Q}) = \{(1:-1:0), (-1:0:1), (0:1:-1)\} \,. \end{aligned}

The curve $$C_5$$ is a plane quintic of genus 6. Note that there is an action of the symmetric group $$S_3$$ on three letters on every curve $$C_d$$ by permuting the coordinates. We can restrict this action to an action of the subgroup $$A_3$$ generated by a cyclic permutation. The quotient $$C'_5$$ of $$C_5$$ by this action of $$A_3$$ is a curve of genus 2. We can compute a singular plane model of $$C'_5$$ by taking the image of $$C_5$$ under the map

\begin{aligned} {\mathbb P}^2 \rightarrow {\mathbb P}^2\,,\quad (x:y:z) \mapsto (xyz : (xy+yz+zx)(x+y+z) : (x-y)(y-z)(z-y)) \,. \end{aligned}

A procedure implemented in Magma [3] then produces the hyperelliptic equation

\begin{aligned} H_5 :y^2 = -3 x^6 + 8 x^5 - 28 x^4 - 30 x^3 + 40 x^2 + 16 x - 15 \end{aligned}

for $$C'_5$$. A 2-descent as described in [29] (and implemented in Magma) shows that the Mordell-Weil rank of the Jacobian J of $$H_5$$ is at most 1. Since one finds a point on J of infinite order (with Mumford representation $$(x^2-x+2, 7x+7)$$), the rank is indeed 1. Using the Magma implementation of Chabauty’s method combined with the Mordell-Weil sieve (see [10]), one quickly finds that the only rational point on this hyperelliptic curve is $$(-1,0)$$. This point must be the image of the three obvious rational points on $$C_5$$. Since any other rational point would have to map to a different point on $$H_5$$, this proves the following.

### Lemma 4.2

\begin{aligned} C_5(\mathbb {Q}) = \{(1:-1:0), (-1:0:1), (0:1:-1)\} \,. \end{aligned}

The combination of Lemmas 4.1 and 4.2 with Lemma 1.1 leads to the following theorem.

### Theorem 4.3

Let $$\Gamma$$ be a k-regular graph with four distinct eigenvalues $$k>\theta _1>\theta _2>\theta _3$$ and let $$s\in \{5,7\}$$. Then $$\Gamma$$ is an $$s$$-SWRG if and only if $$\theta _2=0$$ and $$\theta _3=-\theta _1$$.

Considering larger odd d, we can say the following. The quotient $$C''_7$$ of $$C_7$$ by the full $$S_3$$-action is an elliptic curve, which is isomorphic to the curve with label 10368w1 in the Cremona database (http://www.lmfdb.org/EllipticCurve/Q/10368/j/110368.j1 in the LMFDB [31]). Unfortunately, this curve has rank 2 and therefore has infinitely many rational points. So we cannot use this approach to determine the set of rational points on $$C_7$$.

The quotient $$C''_9$$ of $$C_9$$ by the $$S_3$$-action is a smooth plane quartic curve, isomorphic to the curve with equation

\begin{aligned} x^4&+ 2 x^3 y + x^2 y^2 - x y^3 - y^4 + 2 x^3 z - 4 x^2 y z - 3 x y^2 z \\&+ 2 y^3 z + 4 x^2 z^2 - 3 x y z^2 + 3 y^2 z^2 + 3 x z^3 - 4 y z^3 + z^4 = 0 \,. \end{aligned}

A point search finds the two rational points $$(-5:1:4)$$ and $$(-1:1:0)$$. The first is the image of the three obvious rational points on $$C_9$$, whereas the second point does not lift to a rational point on $$C_9$$. Let J be the Jacobian of the curve. Then $$\#J(\mathbb {F}_3) = 3^3$$ and $$\#J(\mathbb {F}_7) = 11 \cdot 31$$, so $$J(\mathbb {Q})$$ has trivial torsion subgroup. Therefore, the point in $$J(\mathbb {Q})$$ given by the difference of the two rational points has infinite order. It might be possible to use the methods of [9] to determine the rank of $$J(\mathbb {Q})$$. If the rank turns out to be $$\le 2$$, then an application of Chabauty’s method might show that the two known rational points are the only ones.

In any case, searching for rational points does not exhibit any other points than the obvious ones when $$d \ge 3$$ is odd. This leads to the following conjecture, which generalizes the results of Lemmas 4.1 and 4.2.

### Conjecture 4.4

If $$d \ge 3$$ is odd, then

\begin{aligned} C_d(\mathbb {Q}) = \{(1:-1:0), (-1:0:1), (0:1:-1)\} \,. \end{aligned}

Equivalently, all solutions $$(\theta _1, \theta _2, \theta _3)$$ in integers of (1) with $$s\ge 5$$ odd and $$\theta _1> \theta _2 > \theta _3$$ satisfy $$\theta _2 = 0$$ and $$\theta _3 = -\theta _1$$.

## 5 Divisibility for binary linear codes with few weights

In this section we want to study the divisibility properties of the weights and the length of the binary linear codes with few weights. A first but very powerful tool are the MacWilliams identities. In Eqs. (3)–(6), the code has been assumed to be projective, i.e. $$B_2 = 0$$. For the more general situation, we prepare

\begin{aligned} \sum _{i>0} A_i= & {} q^k-1, \end{aligned}
(13)
\begin{aligned} \sum _{i\ge 0} iA_i= & {} q^{k-1}n, \end{aligned}
(14)
\begin{aligned} \sum _{i\ge 0} i^2A_i= & {} q^{k-1}(B_2+n(n+1)/2), \end{aligned}
(15)
\begin{aligned} \sum _{i\ge 0} i^3A_i= & {} q^{k-2}(3(B_2n-B_3)+n^2(n+3)/2), \end{aligned}
(16)

for an [$$n,k]_q$$ code C with $$B_1=0$$.

### Lemma 5.1

(Folklore) Let C be an $$[n,k]_2$$ code and $$C_2$$ the subset of all codewords of even weight. Then $$C_2$$ is a linear subcode of C of dimension k or $$k-1$$.

### Proof

Consider the $$\mathbb {F}_2$$-linear map $$f : C \rightarrow \mathbb {F}_2$$, $$c \mapsto \sum _{i=0}^n c_i$$. Then $$C_2 = \ker f$$ is a linear subspace of C. By the rank-nullity theorem, the codimension of $$C_2$$ in C equals $$\dim \ker f \in \{0,1\}$$. $$\square$$

We call $$C_2$$ the even-weight subcode of C. A direct consequence of Lemma 5.1 is the following.

### Lemma 5.2

Let C be an $$[n,k]_2$$ code of dimension $$k \ge 2$$. Then C has a non-zero even weight.

### Lemma 5.3

Let C be a linear binary $$[n,k]_2$$ three-weight code. Then $$k \ge 2$$. If C is projective, then $$k \ge 3$$.

### Proof

if $$k \le 1$$, then C consists of at most a single non-zero codeword, so C cannot have three different weights.

Assume that C is projective of dimension $$k=2$$ and let G be a generator matrix of C. Then G neither has a zero column, nor a repeated column. Therefore, each of the $$2^k - 1 = 3$$ possible column vectors in $$\mathbb {F}_2^2\setminus \{{\textbf{0}}\}$$ appears at most once as a column of G, implying that $$n \le 3$$. As C has three different non-zero weights, $$n \ge 3$$, so together we get $$n = 3$$ and each of the 3 non-zero vectors appears exactly once as a column of G. Therefore, C is isomorphic to the simplex code $${{\,\textrm{Sim}\,}}_2(2)$$, which is a constant weight code. This is a contradiction. $$\square$$

### Remark 5.4

There are indeed (many) non-projective binary three-weight codes of dimension 2. An example for the smallest possible length $$n = 3$$ is given by the generator matrix $$({\begin{matrix}1 &{} 0 &{} 0 \\ 0 &{} 1 &{} 1\end{matrix}})$$, which spans a code with the weight distribution $$(0^1 1^1 2^1 3^1)$$.

### Lemma 5.5

Let C be a projective full-length $$[n,k]_2$$ three-weight code with non-zero weights $$w_1$$, $$w_2$$ and $$w_3$$, such that n is even and exactly one weight is odd. W.l.o.g. let $$w_2$$ be the odd weight.

Then $$w_2=\frac{n}{2}$$ and the even-weight subcode $$C_2$$ of C has effective length n and is a 2-fold replication of a projective $$\left[ \tfrac{n}{2},k-1\right] _2$$ two-weight code with non-zero weights $$\frac{w_1}{2}$$ and $$\frac{w_3}{2}$$.

### Proof

Let $$A_{w_i}$$ be the number of codewords of weight $$w_i$$ in C. Furthermore, let $$(B_i)$$ be the dual weight distribution of C and $$(B'_i)$$ the dual weight distribution of $$C_2$$. Since C is projective, we have $$B_1 = B_2 = 0$$. We set $$y=2^{k-2} = \frac{1}{4}\#C$$. By Lemma 5.3, $$y\in \mathbb {Z}$$. Since $$w_2$$ is the only odd weight, Lemma 5.1 gives $$A_{w_2} = 2y$$. Now Eq. (4) applied to C yields

\begin{aligned} w_1 A_{w_1} + w_3 A_{w_3} = 2y(n-w_2)\text {.} \end{aligned}

From Lemma 5.1 we conclude that $$C_2$$ is a two-weight code of dimension $$k-1$$ and effective length $$n' \le n$$ with non-zero weights $$w_1$$ and $$w_3$$. Since C is projective, we have $$n'\in \{n-1,n\}$$. Noting that $$A_{w_1}$$ and $$A_{w_3}$$ are also the numbers of codewords of weights $$w_1$$ and $$w_3$$ in $$C_2$$, the application of Eq. (14) to the full-length code arising from $$C_2$$ after (possibly) removing the zero position yields

\begin{aligned} w_1A_{w_1}+w_3A_{w_3}= & {} n'y\text {.} \end{aligned}
(17)

Hence $$n'y = 2y(n-w_2)$$ and thus $$n' = 2(n - w_2)$$ is even. By the assumtion that n is even, $$n' = n-1$$ is not possible. Therefore $$n'=n$$ and $$w_2=\frac{n}{2}$$. So $$C_2$$ is full-length and hence $$B'_1 = 0$$. Now the difference of Eq. (15) for C and $$C_2$$ with $$w_2 = \frac{n}{2}$$, $$A_{w_2} = 2y$$ and $$B_2 = 0$$ gives

\begin{aligned} \frac{n^2}{4} \cdot 2y = 2y \cdot \frac{n(n+1)}{2} - y \left( B'_2 + \frac{n(n+1)}{2}\right) \text {,} \end{aligned}

which simplifies to $$\frac{n^2}{2} = \frac{n(n+1)}{2} - B'_2$$ and further to $$B'_2 = \frac{n}{2}$$. As C is projective, the position multiplicities of the codimension 1 subcode $$C_2$$ are at most 2. Denoting the number of position pairs of multiplicity 2 by m, Lemma 2.4 yields $$m = B_2' = \frac{n}{2}$$. Therefore, all positions of $$C_2$$ appear with multiplicity 2 and thus, $$C_2$$ is the two-fold repetition of a projective two-weight code with non-zero weights $$\frac{w_1}{2}$$ and $$\frac{w_3}{2}$$. $$\square$$

### Remark 5.6

As seen in the above proof, in the situation of Lemma 5.5 we have $$A_{w_2} = 2y$$. Moreover, we can use Eqs. (13) and (14) to compute the frequencies

\begin{aligned} A_{w_1} = \frac{(2y-1) w_3 - yn}{w_3 - w_1} \quad \text {and}\quad A_{w_3} = \frac{yn - (2y - 1)w_1}{w_3 - w_1} \end{aligned}

depending on the weights $$w_1$$ and $$w_3$$.

From now on, we add the extra constraint $$w_1+w_2+w_3=\tfrac{3n}{2}$$.

### Corollary 5.7

Let C be a projective $$[n,k]_2$$ three-weight code with non-zero weights $$w_1$$, $$w_2$$ and $$w_3$$ satisfying $$w_1+w_2+w_3=\tfrac{3n}{2}$$. Then n is a multiple of 4.

### Proof

Since $$\tfrac{3n}{2} = w_1+w_2+w_3$$ is an integer, n has to be even, so that we assume $$n\equiv 2\pmod 4$$. Then $$\tfrac{3n}{2}=w_1+w_2+w_3$$ is odd. By Lemma 5.2, C has an even weight, so exactly one weight of C is odd. Without restriction, let $$w_2$$ be the odd weight. Lemma 5.5 yields $$w_2 = \frac{n}{2}$$. From $$w_1+w_2+w_3=\frac{3}{2} n$$ we may further assume $$w_1< w_2 < w_3$$, so $$w_1=\tfrac{n}{2}-t$$ and $$w_3=\tfrac{n}{2}+t$$ for some positive integer t. Since $$w_1$$ and $$w_3$$ are even, t has to be odd. Moreover, Lemma 5.5 says that $$\frac{w_1}{2}$$ and $$\frac{w_3}{2}$$ are the weights of a projective binary two-weight code. By Lemma 2.2 the weight difference $$\tfrac{w_3}{2}-\tfrac{w_1}{2}=t$$ has to be a power of 2. Since t is odd, we conclude that $$t=1$$, so

\begin{aligned} w_1 = \frac{n}{2}-1\text {,}\quad w_2 = \frac{n}{2}\quad \text {and}\quad w_3 = \frac{n}{2}+1\text {.} \end{aligned}

Writing $$y = 2^{k-2}$$, the frequencies from Remark 5.6 evaluate to

\begin{aligned} A_{w_1} = y -\frac{n}{4} - \frac{1}{2}\text {,}\quad A_{w_2} = 2y \quad \text {and}\quad A_{w_3} = y + \frac{n}{4} - \frac{1}{2}\text {.} \end{aligned}
(18)

Plugging these expressions into Eq. (5) leads to

\begin{aligned} n^2y + 2y + \frac{n^2}{4} - 1 = n(n+1)y \end{aligned}

and further to the quadratic equation

\begin{aligned} n^2 - 4ny + (8y - 4) = 0 \end{aligned}

with the two solutions $$n \in \{2, 4y - 2\}$$. Since the length of a three-weight code is at least 3, necessarily $$n=4y-2$$. Now Eq. (18) yields $$A_{w_1}=0$$ – a contradiction. $$\square$$

Using the abbreviation $$y=2^{k-2}$$, we prepare Eqs. (7)–(10) in the special case $$w_1=\tfrac{n}{2}-t$$, $$w_2 = \frac{n}{2}$$ and $$w_3=\tfrac{n}{2}+t$$.

\begin{aligned} A_{w_1}= & {} \frac{n(4y - n - 2t)}{8t^2} \end{aligned}
(19)
\begin{aligned} A_{w_2}= & {} 4y - 1 - \frac{n(4y-n)}{4t^2} \end{aligned}
(20)
\begin{aligned} A_{w_3}= & {} \frac{n(4y - n +2t)}{8t^2}\end{aligned}
(21)
\begin{aligned} 3B_3= & {} \frac{n(n-2t)(n+2t)}{8y} \end{aligned}
(22)

### Lemma 5.8

Let C be a projective $$[n,3]_2$$ three-weight code with non-zero weights $$w_1< w_2 < w_3$$ satisfying $$w_1+w_2+w_3=\tfrac{3n}{2}$$. Then C has length $$n=4$$, weight distribution $$(0^1 1^1 2^3 3^3)$$ and is isomorphic to the code spanned by the generator matrix

\begin{aligned} \left( \begin{matrix} 1&{}0&{}0&{}0\\ 0&{}1&{}0&{}1\\ 0&{}0&{}1&{}1 \end{matrix}\right) \text {.} \end{aligned}

### Proof

By Lemma 2.3, $$n \le 5$$, and by Corollary 5.7, $$4 \mid n$$. Therefore $$n = 4$$. The code C is isomorphic to a systematic code, which has a generator matrix of the form $$(I_3 \mid v)$$, where $$I_3$$ denotes the $$3\times 3$$ unit matrix and v is a vector in $$\mathbb {F}_2^3$$. As C is projective, $$w(v) \ge 2$$. Furthermore, $$w(v) = 3$$ is not possible, as C would have only the two weights 2 and 4. So $$w(v) = 2$$. We note that the three possibilities for v lead to equivalent codes, and that the resulting code has the stated weight distribution. $$\square$$

We remark that geometrically, the above $$[4,3]_2$$ code corresponds to the complement of a triangle in the projective plane $${{\,\textrm{PG}\,}}(2,2)$$.

### Theorem 5.9

Let C be a projective $$[n,k]_2$$ three-weight code with non-zero weights $$w_1< w_2 < w_3$$ satisfying $$w_1+w_2+w_3=\tfrac{3n}{2}$$. Then n is a multiple of 4, and one of the following cases occurs.

1. (i)

$$k\ge 4$$, $$n\ge 8$$ and all weights of C are even.

2. (ii)

The code C has the parameters $$[4,3]_2$$ and is isomorphic to the code in Lemma 5.8.

### Proof

By Corollary 5.7, n is a multiple of 4.

In the case that n has only even weights, the largest weight is at least 6, so $$n \ge 8$$. Moreover, $$k \ge 4$$ by Lemma 5.8.

Now we assume that C has an odd weight. As $$\frac{n}{2}$$ is even, C has at least two odd weights by Lemma 5.5. Since $$w_1 + w_2 + w_3 = n$$ is even, we get that C has exactly two odd weights, say $$w_1$$ and $$w_3$$. Let $$C_2$$ be the even-weight subcode of C. The code C is projective and by Lemma 5.1, the codimension of $$C_2$$ in C is 1. Therefore, the maximum position multiplicity of $$C_2$$ is at most 2, and the effective length $$n'$$ of $$C_2$$ is either $$n-1$$ or n. Since $$w_2$$ is the only even weight of C, the subcode $$C_2$$ is a code of constant weight $$w_2$$ and frequency $$A_{w_2}=\#C_2 - 1 = 2^{k-1}-1$$. From Lemma 2.1 we conclude that $$w_2 = u\cdot 2^{k-2}$$ and $$n'=u\cdot (2^{k-1}-1)$$ with an integer $$u\in \{1,2\}$$, where $$u \le 2$$ follows from the maximum position multiplicity.

Let us first investigate the case $$u=2$$. Here, $$n'=2^k-2$$ and $$n \in \{2^k-2, 2^k-1\}$$. Let G be a generator matrix of C. Since C is projective, G neither has a zero column, nor a repeated column. So each of the $$2^k-1$$ non-zero vectors in $$\mathbb {F}_2^k$$ occurs exactly once as a column in G, possibly with the excection that a single vector might not occur at all. In the case $$n = 2^k - 1$$, all vectors occur as a column in G, so $$C = {{\,\textrm{Sim}\,}}_2(k)$$, which is a code of constant weight $$2^{k-1}$$. In the case $$n = 2^k - 2$$, C is the simplex code $${{\,\textrm{Sim}\,}}_2(k)$$ punctured in a single position, so C has the two weights $$2^{k-1}$$ and $$2^{k-1}-1$$.Footnote 3 This contradicts the assumption that C is a three-weight code.

It remains to consider $$u=1$$. Here, $$w_2 = 2^{k-2}$$ and $$n' = 2^{k-1} - 1$$, which is odd. Since n is even, necessarily $$n' = n-1$$, so $$n = 2^{k-1}$$ and $$w_2 = \frac{n}{2}$$. Combined with $$w_1 + w_2 + w_3 = \frac{3n}{2}$$ we can write $$w_1=\tfrac{n}{2}-t$$ and $$w_3=\tfrac{n}{2}+t$$ for some positive integer t. Together with the abbreviation $$y = 2^{k-2}$$, Eqs. (19)–(21) can be simplified to

\begin{aligned} A_{w_1}= & {} \frac{y(y-t)}{2t^2}\\ A_{w_2}= & {} 4y - 1 - \frac{y^2}{t^2} \\ A_{w_3}= & {} \frac{y(y+t)}{2t^2}. \end{aligned}

Now we use $$A_{w_2}=2^{k-1}-1=2y-1$$ to conclude $$y=2t^2$$ (or $$y=0$$, which is impossible). As y is a power of 2, so is t. From $$w_1 = t(2t - 1)$$ odd we get that t is is odd. Together, this forces $$t = 1$$, which gives $$y = 2$$ and therefore $$k = 3$$. Therefore, C is isomorphic to the code in Lemma 5.8. $$\square$$

### Lemma 5.10

Let C be a projective $$[n,k]_2$$ three-weight code with non-zero weights $$w_1< w_2 < w_3$$ satisfying $$w_1+w_2+w_3=\tfrac{3n}{2}$$ and $$w_2 = \frac{n}{2}$$. Then $$w_1 = w_2 - t$$ and $$w_3 = w_2 + t$$ where t is a power of 2. Moreover, $$2t \mid n$$, and t is the largest integer $$\Delta$$ such that C is $$\Delta$$-divisible.

### Proof

Equations (19) and (21) give $$A_{w_3} - A_{w_1} =\tfrac{n}{2t}$$, so $$2t \mid n$$. Therefore $$t \mid w_2 = \frac{n}{2}$$, implying that t is the greatest common divisor of $$w_1 = w_2 - t$$, $$w_2$$ and $$w_3 = w_2 + t$$, so $$\Delta = t$$. Since C is projective, C cannot be the proper repetition of some code. Now as a consequence of [33, Theorem 1], the number $$\Delta = t$$ must be a power of 2. $$\square$$

### Lemma 5.11

Let C be a projective $$[n,k]_2$$ three-weight code with non-zero weights $$w_1< w_2 < w_3$$ satisfying $$w_1+w_2+w_3=\tfrac{3n}{2}$$ and $$w_2=\tfrac{n}{2}$$. Let $$a \ge 0$$ be the largest integer such that C is $$2^a$$-divisible. Then $$k \le 8a + 9$$.

### Proof

As before, we will use the abbreviation $$y=2^{k-2}$$ and write $$w_1=\tfrac{n}{2}-t$$ and $$w_3=\tfrac{n}{2}+t$$ with an integer $$t \ge 1$$. By Lemma 5.3, $$y\in \mathbb {Z}$$. By Lemma 5.10, $$t = 2^a$$ is the largest integer $$\Delta$$ such that C is $$\Delta$$-divisible. There is an odd integer z and a non-negative integer x with $$n = 2^x \cdot z$$. Since C is projective, $$n \le 2^k - 1$$. Together with $$2t \mid n$$, we get $$a+1\le x\le k-1$$.

Plugging $$t = 2^a$$, $$n = 2^x z$$ and $$y = 2^{k-2}$$ into Eqs. (19)–(22) we get

\begin{aligned} A_{w_1}= & {} \frac{z\cdot (2^{k-a-1}-2^{x-a-1} z - 1)}{2^{a+2-x}}\text {,} \end{aligned}
(23)
\begin{aligned} A_{w_2}= & {} 2^{2(x-a-1)}z^2 + 2^{k} - 2^{x+k-2a-2}z - 1\text {,} \end{aligned}
(24)
\begin{aligned} A_{w_3}= & {} \frac{z\cdot (2^{k-a-1}-2^{x-a-1}z + 1)}{2^{a+2-x}}\text {,} \end{aligned}
(25)
\begin{aligned} 3B_3= & {} \frac{z\cdot \left( 2^{x-a-1}z - 1\right) \cdot \left( 2^{x-a-1}z + 1\right) }{2^{k-x-2a-1}}\text {.} \end{aligned}
(26)

First case: $$k \ge x + 2a + 2$$. Equivalently, $$k-x-2a-1\ge 1$$, so the denominator of the right hand side of Eq. (26) is even. By $$B_3\in {\mathbb {Z}}$$, the numerator is even, too. Since z is odd, this implies $$a = x-1$$. Now $$0 < w_1 = \frac{n}{2}-t = 2^{x-1} z - 2^a = 2^a (z - 1)$$ yields $$z > 1$$. Equation (26) with $$a = x-1$$ yields

\begin{aligned} 3 B_3 = \frac{z\cdot \left( z - 1\right) \cdot \left( z + 1\right) }{2^{k-3x+1}}\text {.} \end{aligned}

From our precondition $$k \ge x + 2a + 2 = 3x$$ we have $$k - 3x\ge 0$$, so $$2^{k-3x}$$ is an integer. Since $$\gcd (z-1,z+1)=2$$, we have that $$2^{k-3x}$$ either divides $$z-1$$ or $$z+1$$. Therefore, $$z=s\cdot 2^{k-3x}+\alpha$$ for some integer s and $$\alpha \in \{-1,1\}$$. By $$z > 1$$, $$s \ge 1$$. Now Eq. (23) yields

\begin{aligned} 0 < \frac{2^{a+2-x}}{z}\cdot A_{w_1} = 2^{k-x}-\left( s\cdot 2^{k-3x}+\alpha +1\right) \le 2^{k-x}-s\cdot 2^{k-3x}\text {,} \end{aligned}

so that $$s<2^{2x}$$ and hence $$s\le 2^{2x}-1$$.

Using Eq. (24) we get

\begin{aligned} 0&< s (A_{w_2} + 1) \\&= s (z^2 + 2^k) + s\cdot z \cdot 2^{k-x} \\&\le (2^{2x} - 1)((s 2^{k-3x} + \alpha )^2 + 2^k) - s(s2^{k-3x} + \alpha ) 2^{k-x} \\&= (2^{2x} - 1)(s^2 2^{2k-6x} + 2\alpha s 2^{k-3x} + 1 + 2^k) - s(s2^{k-3x} + \alpha ) 2^{k-x} \\&= s^2 2^{2k-4x} + 2\alpha s 2^{k-x} + 2^{2x} + 2^{k+2x} - s^2 2^{2k-6x} - \alpha s 2^{k-3x+1} - 1 - 2^k \\&\qquad - s^2 2^{2k-4x} - \alpha s 2^{k-x} \\&= \alpha s (2^{k-x} - 2^{k-3x+1}) + (2^{2x} + 2^{k+2x}) - s^2 2^{2k-6x} - (1 + 2^k) \\&\le 2s\cdot 2^{k+2x} + 2s\cdot 2^{k + 2x} - s 2^{2k-6x} \\&= s(2^{k+2x+2} - s^{2k - 6x}) \text {,} \end{aligned}

where in the second last step $$s \ge 1$$ has been used. Therefore $$k + 2x + 2 > 2k - 6x$$ and hence

\begin{aligned} k \le 8x + 1 = 8(a + 1) + 1 = 8a + 9\text {.} \end{aligned}

Second case: $$k\le x+2a+1$$. Equation (19) implies

\begin{aligned} 0< \frac{8t^2}{n} A_{w_1} = 4y - n - 2t < 4y - n\text {.} \end{aligned}

We have $$2^x \mid n$$ and from $$x \le k-1$$ also $$2^x \mid 2^k = 4y$$. Therefore $$2^x \mid 4y - n > 0$$ and thus $$4y - n \ge 2^x$$.

By Eq. (20),

\begin{aligned} 0&< 4t^2 A_{w_2} \\&= 4t^2(4y - 1) - n(4y-n) \\&\le 4t^2\cdot 4y - n\cdot 2^x \\&= 2^{k + 2a + 2} - 2^{2x} z \\&\le (2^{k + 2a + 2} - 2^{2x}) \end{aligned}

and thus $$k + 2a + 2 > 2x$$ and $$k \ge 2x - 2a - 1$$. Combined with $$k\le x+2a+1$$, finally

\begin{aligned} k = 2k - k \le 2(x + 2a + 1) - (2x - 2a - 1) = 6a + 3 < 8a + 9\text {.} \end{aligned}

$$\square$$

By Lemmas 5.11 and 2.3, the following numbers K(r) and N(r) are well-defined.

### Definition 5.12

Let $$a \ge 1$$ be an integer. We define K(a) (resp. N(a)) as the largest dimension (resp. length) of a projective $$[n,k]_2$$ three-weight code C with non-zero weights $$w_1< w_2 < w_3$$ satisfying $$w_1+w_2+w_3=\tfrac{3n}{2}$$ and $$w_2=\tfrac{n}{2}$$ such that C is not $$2^a$$-divisible.

### Theorem 5.13

Let $$a \ge 1$$ be an integer. Then

\begin{aligned} 2a + 1 \le K(a) \le 8a + 1 \qquad \text {and}\qquad 2^{2a + 1} - 2^{a+1} \le N(a) \le 2^{K(a)} - 3\text {.} \end{aligned}

### Proof

$$K(a) \le 8(a-1) + 9 = 8a + 1$$ by Lemma 5.11 and $$N(a) \le 2^{K(a)} - 3$$ by Lemma 2.3.

For the lower bounds, let $$C = {{\,\textrm{Sim}\,}}_2(a) \oplus {{\,\textrm{RM}\,}}_2(a+1)$$. It is a projective three-weight code of length $$n = (2^a - 1) + 2^a = 2^{a+1} - 1$$, dimension $$k = a + (a+1) = 2a + 1$$ and weights $$w_1 = 2^{a-1}$$, $$w_2 = 2^a$$ and $$w_3 = 3\cdot 2^{a-1}$$.Footnote 4 Since C does not have the weight $$2^{k-1} = 2^{2a}$$, the anticode $$C^\complement$$ is defined. It is a projective three-weight code of the same dimension k, length $$n^\complement = (2^k - 1) - n = 2^{2a + 1} - 2^{a+1}$$ and the three non-zero weights

\begin{aligned} w^\complement _1&= 2^{k-1} - w_3 = 2^{2a} - 3\cdot 2^{a-1} = 2^{a-1}(2^{a+1} - 3)\text {,} \\ w^\complement _2&= 2^{k-1} - w_2 = 2^{2a} - 2^a = 2^{a-1}(2^{a+1} - 2)\quad \text {and} \\ w^\complement _3&= 2^{k-1} - w_1 = 2^{2a} - 2^{a-1} = 2^{a-1}(2^{a+1} - 1)\text {,} \end{aligned}

so $$C^\complement$$ is $$2^{a-1}$$-divisible, but not $$2^a$$-divisible. Furthermore

\begin{aligned} w_1^\complement + w_2^\complement + w_3^\complement = 3\cdot 2^{2a} - 3\cdot 2^a = \frac{3}{2} n^\complement \qquad \text {and}\qquad w_2^\complement = \frac{n^\complement }{2}\text {.} \end{aligned}

Therefore, $$K(a) \ge k = 2a + 1$$ and $$N(a) \ge n^\complement = 2^{2a + 1} - 2^{a+1}$$. $$\square$$

For small values of a, we can determine the exact values of N(a) and K(a).

### Theorem 5.14

1. (a)

$$K(1) = 3$$ and $$N(1) = 4$$.

2. (b)

$$K(2) = 6$$ and $$N(2) = 56$$.

3. (c)

$$K(3) = 11$$ and $$N(3) = 2024$$.

### Proof

The case $$a = 1$$: The values $$K(1) = 3$$ and $$N(1) = 4$$ are a direct consequence of Theorem 5.9.Footnote 5

The case $$a = 2$$: Using $$K(2) \le 17$$ from Theorem 5.13 and $$t = 2^a = 4$$ from Lemma 5.10, we determined all feasible parameters computationally. The ones with $$k \ge 7$$ are listed below.

\begin{aligned} \begin{array}{rrrrr} n &{} k &{} w_1 &{} w_2 &{} w_3 \\ \hline 244 &{} 8 &{} 120 &{} 122 &{} 124 \\ 116 &{} 7 &{} 56 &{} 58 &{} 60 \\ 112 &{} 7 &{} 54 &{} 56 &{} 58 \\ 16 &{} 7 &{} 6 &{} 8 &{} 10 \end{array} \end{aligned}

The last code has already been excluded in Sect. 3 via Lemma 3.1. Of the first three codes, the anticodes would have the parameters [11, 8, 4], [11, 7, 4] and [15, 7, 6]. The application of the Hamming bound to the punctured parameters [10, 7, 3], [10, 6, 3] and [14, 7, 5] shows that these codes do not exist.

Among all feasible parameters with $$k \le 6$$, the ones with the largest possible length are $$n = 56$$, $$k = 6$$, $$w_1 = 26$$, $$w_2 = 28$$ and $$w_3 = 30$$. These parameters are realized by the anticode of the binary $$[7,6]_2$$ parity check code.

The case $$a = 3$$: Similar as before, based on $$K(3) \le 25$$ and $$t = 8$$ we were able to determine all feasible parameters computationally. There is only a single feasible parameter set with $$k\ge 12$$, which is $$n=4040$$, $$k=12$$, $$w_1 = 2016$$, $$w_2 = 2020$$ and $$w_3 = 2024$$. The anticode would have the parameters [55, 12, 24], which does not exist according to the online tables [17].

Among all parameters with $$k \le 11$$, the ones with the largest possible length are $$n = 2024$$, $$k = 11$$, $$w_1 = 1008$$, $$w_2 = 1012$$ and $$w_3 = 1016$$. These parameters are realized by the code $$(C^\perp )^\complement$$, where C is the binary $$[23,12]_2$$ Golay code. The code $$C^\perp$$ has the weight enumerator $$1 + 506 x^8 + 1288 x^{12} + 253 x^{16}$$. $$\square$$

Theorem 5.14 indicates that in general, neither the lower nor the upper bound of Theorem 5.13 are sharp. We leave it as a research problem to improve the bounds and further investigate the asymptotic growth.