# Optimal three-weight cyclic codes whose duals are also optimal

Gerardo Vega and Félix Hernández G. Vega is with the Dirección General de
Cómputo y de Tecnologías de Información y Comunicación, Universidad Nacional
Autónoma de México, 04510 México D.F., MEXICO (e-mail: gerardov@unam.mx).F.
Hernández is a PhD student at the Posgrado en Ciencia e Ingeniería de la
Computación, Universidad Nacional Autónoma de México, 20059 México, D.F.,
MEXICO (e-mail: felixhdz@ciencias.unam.mx). Manuscript partially supported by
CONACyT, México.

###### Abstract

A class of optimal three-weight cyclic codes of dimension 3 over any finite
field was presented by Vega [Finite Fields Appl., 42 (2016) 23-38]. Shortly
thereafter, Heng and Yue [IEEE Trans. Inf. Theory, 62(8) (2016) 4501-4513]
generalized this result by presenting several classes of cyclic codes with
either optimal three weights or a few weights. Here we present a new class of
optimal three-weight cyclic codes of length $q+1$ and dimension 3 over any
finite field ${\rm I\\!F}_{q}$, and show that the nonzero weights are $q-1$,
$q$, and $q+1$. We then study the dual codes in this new class, and show that
they are also optimal cyclic codes of length $q+1$, dimension $q-2$, and
minimum Hamming distance $4$. Lastly, as an application of the Krawtchouck
polynomials, we obtain the weight distribution of the dual codes.

Keywords: Optimal three-weight cyclic codes, optimal dual cyclic codes,
Griesmer lower bound, weight distribution of a code.

##  I Introduction

The problem of obtaining the weight distribution of a given code is important
because it plays a significant role in determining the capabilities of error
detection and correction of such a code. For cyclic codes this problem is even
more important because this kind of codes possess a rich algebraic structure
(they are ideals in the principal ideal ring ${\rm I\\!F}_{q}[x]/(x^{n}-1)$,
where $n$ is the length of the cyclic codes). On the other hand, it is known
that cyclic codes with few weights have a great practical importance in
cryptography and coding theory since they are useful in the design of secret
sharing schemes and association schemes (see [1, 2]). A characterization of a
class of optimal three-weight cyclic codes of dimension 3, over any finite
field ${\rm I\\!F}_{q}$, was presented in [11], and shortly thereafter,
several classes of cyclic codes with either optimal three weights or a few
weights were given in [5], showing that one of these classes can be
constructed as a generalization of the sufficient numerical conditions of the
characterization given in [11].

In this paper we use a particular kind of one-weight and semiprimitive two-
weight irreducible cyclic codes of dimension $2$ to construct a new class of
optimal three-weight cyclic codes of length $q+1$ and dimension 3, over any
finite field ${\rm I\\!F}_{q}$, whose nonzero weights correspond to the three
largest possible weights, that is $q-1$, $q$, and $q+1$. The codes in this
class are optimal in the sense that their lengths reach the Griesmer lower
bound for linear codes. Furthermore, without the need of any exponential sum,
we explicitly determine the weight distribution for the cyclic codes in this
class. With the knowledge of this weight distribution, we then study the
corresponding dual codes showing that, except for a single case, all of them
have minimum Hamming distance $4$. In consequence, since the length, dimension
and minimum Hamming distance of the dual codes are $q+1$, $q-2$, and 4,
respectively, we conclude that these codes are also optimal. As an application
of the Krawtchouck polynomials, we obtain the weight distribution of the dual
codes, in which it is clear that all of them are $(q-2)$-weight cyclic codes
for $q\geq 5$. Therefore, in addition to our new class of optimal cyclic
codes, this last result gives access to an infinite family of optimal
$(q-2)$-weight cyclic codes of length $q+1$, and dimension $q-2$, whose
minimum Hamming distance is $4$.

This work is organized as follows: In Section II we establish some notation,
recall some definitions and already known results related to the weight
distributions of one-weight and semiprimitive two-weight irreducible cyclic
codes of dimension $2$. In addition, we also recall the Griesmer lower bound
for linear codes, the five first identities of Pless, and the definition for
the Krawtchouck polynomials. In Section III some preliminary results are
presented. Particularly, a description of the nature of the codewords in
either a one-weight or a semiprimitive two-weight irreducible cyclic code of
dimension $2$. This description is then used in Section IV to present a new
class of optimal three-weight cyclic codes of dimension 3 over any finite
field, showing that their dual codes are also optimal. Examples of optimal
three-weight cyclic codes belonging to this new class, along with their
corresponding dual codes, are presented at the end of this section. Finally,
Section V is devoted to conclusions.

##  II Definitions, notation and some known results

Unless otherwise specified, throughout this work we are going to use the
following:

Notation. By using $q$ and $k$, we will denote positive integers such that $q$
is the power of a prime number. For integers $v$ and $w$, with $\gcd(v,w)=1$,
$\mbox{ord}_{v}(w)$ will denote the multiplicative order of $w$ modulo $v$.
“$\mbox{Tr}_{{\rm I\\!F}_{q^{k}}/{\rm I\\!F}_{q}}$” will denote the trace
mapping from ${\rm I\\!F}_{q^{k}}$ to ${\rm I\\!F}_{q}$. By using $\gamma$, we
will denote a fixed primitive element of ${\rm I\\!F}_{q^{k}}$, and for any
integer $a$, the polynomial $h_{a}(x)\in{\rm I\\!F}_{q}[x]$ will denote the
minimal polynomial of $\gamma^{-a}$ (see, for example, [7, p. 99]). In
addition, ${\cal C}_{(n,q^{k})}$ will denote the irreducible cyclic code of
length $n=\frac{q^{k}-1}{\gcd(q^{k}-1,a)}$, whose parity-check polynomial is
$h_{a}(x)$. Note that ${\cal C}_{(n,q^{k})}$ is an $[n,k^{\prime}]$ linear
code, where its dimension $k^{\prime}=\deg(h_{a}(x))=\mbox{ord}_{n}(q)$ is a
divisor of $k$. Note also that ${\cal C}_{(n,q^{k})}$ is not several
repetitions of an irreducible cyclic code of smaller block length.

Let ${\cal C}$ be a linear code of length $n$ over ${\rm I\\!F}_{q}$. Then,
the dual code, ${\cal C}^{\perp}$, of ${\cal C}$ is the linear code defined by

${\cal C}^{\perp}:=\\{v\in{\rm I\\!F}_{q}^{n}\>|\>\langle v,c\rangle=0,\mbox{
for all }c\in{\cal C}\\}\;,$

where $\langle v,c\rangle$ is a scalar product in the vector space ${\rm
I\\!F}_{q}^{n}$. It is known that if ${\cal C}$ is an $[n,k]$ linear code,
then its dual code, ${\cal C}^{\perp}$, is an $[n,n-k]$ linear code. For
$0\leq i\leq n$, $A_{i}$ and $A_{i}^{\perp}$ will denote the number of
codewords of weight $i$ in ${\cal C}$ and in ${\cal C}^{\perp}$, respectively.

An $M$-weight code is a code such that the cardinality of the set of nonzero
weights is $M$. That is, $M=|\\{i:A_{i}\neq 0,i=1,2,3,\ldots,n\\}|$.

An alternative definition for an irreducible cyclic code is as follows:

###### Definition 1

[9, Definition 2.2] Let $n$ be a positive divisor of $q^{k}-1$. Then, an
irreducible cyclic code, ${\cal C}_{(n,q^{k})}$, of length $n$ and dimension
$\textrm{\rm ord}_{n}(q)$, over ${\rm I\\!F}_{q}$, is the set

${\cal C}_{(n,q^{k})}:=\\{c(\beta)\>|\>\beta\in{\rm I\\!F}_{q^{k}}\\}\;,$

where

$c(\beta):=(\textrm{\rm Tr}_{{\rm I\\!F}_{q^{k}}/{\rm
I\\!F}_{q}}(\beta\gamma^{\frac{q^{k}-1}{n}i}))_{i=0}^{n-1}\;.$

###### Remark 1

Note that, thanks to Delsarte’s Theorem (see, for example, [3]), the parity-
check polynomial of the irreducible cyclic code under the previous definition
is $h_{-\frac{q^{k}-1}{n}}(x)$.

Now, for the particular case of $k=2$, let $n_{1}$ and $n_{2}$ be divisors of
$q^{2}-1$ and assume that $n_{1}|(q-1)$ and $n_{2}\nmid(q-1)$. Note that under
these circumstances, $\gamma^{q+1}$ is a primitive element of ${\rm
I\\!F}_{q}$, $\textrm{\rm ord}_{n_{1}}(q)=1$, and $\textrm{\rm
ord}_{n_{2}}(q)=2$. With this in mind, we present the following:

###### Definition 2

Let $n_{1}$ and $n_{2}$ be as before, and let
$n=(q^{2}-1)/\gcd(\frac{q^{2}-1}{n_{1}},\frac{q^{2}-1}{n_{2}})$. Then, a
reducible cyclic code of length $n$ and dimension $3$, ${\cal
C}_{(n_{1},n_{2},q^{2})}$, over ${\rm I\\!F}_{q}$, is given by the set:

${\cal C}_{(n_{1},n_{2},q^{2})}:=\\{c(\alpha,\beta)\>|\>\alpha\in{\rm
I\\!F}_{q},\>\beta\in{\rm I\\!F}_{q^{2}}\\}\;,$

where

$c(\alpha,\beta):=(\alpha(\gamma^{q+1})^{\frac{q-1}{n_{1}}i}+\textrm{\rm
Tr}_{{\rm I\\!F}_{q^{2}}/{\rm
I\\!F}_{q}}(\beta\gamma^{\frac{q^{2}-1}{n_{2}}i}))_{i=0}^{n-1}\;.$

When constructing a code, from an economical point of view, it is desirable to
obtain an $[n,k,d]$ code ${\cal C}$ over ${\rm I\\!F}_{q}$ whose length $n$ is
minimal for given values of $k$, $d$ and $q$. A lower bound for the length $n$
in terms of these values is as follows. Let $n_{q}(k,d)$ be the minimum length
$n$ for which an $[n,k,d]$ linear code, over ${\rm I\\!F}_{q}$, exists. If the
values of $q$, $k$ and $d$ are given, then a well-known lower bound (see [4]
and [10]) for $n_{q}(k,d)$ is:

###### Theorem 1

(Griesmer bound) With the previous notation,

$n_{q}(k,d)\geq\sum_{i=0}^{k-1}\left\lceil\frac{d}{q^{i}}\right\rceil\;,$

where $\left\lceil x\right\rceil$ denotes the smallest integer greater than or
equal to $x$.

Let ${\cal C}$ be a linear code of length $n$ and dimension $k$ over ${\rm
I\\!F}_{q}$. With our notation, fix $m=n(q-1)$, and suppose that the weight of
the dual of ${\cal C}$ is at least 2 (that is, $A_{1}^{\perp}=0$). Then, the
five first identities of Pless (see either [6, pp. 259-260] or [8] for the
general result), for ${\cal C}$, are:

$\displaystyle\sum_{i=1}^{n}A_{i}$ $\displaystyle=$ $\displaystyle q^{k}-1\;,$
$\displaystyle\sum_{i=1}^{n}iA_{i}$ $\displaystyle=$ $\displaystyle
q^{k-1}m\;,$ $\displaystyle\sum_{i=1}^{n}i^{2}A_{i}$ $\displaystyle=$
$\displaystyle q^{k-2}[m(m+1)+2A_{2}^{\perp}]\;,$
$\displaystyle\sum_{i=1}^{n}i^{3}A_{i}$ $\displaystyle=$ $\displaystyle
q^{k-3}[m(m(m+3)-q+2)+6(m-q+2)A_{2}^{\perp}-6A_{3}^{\perp}]\;,$
$\displaystyle\sum_{i=1}^{n}i^{4}A_{i}$ $\displaystyle=$ $\displaystyle
q^{k-4}[m(m(m(m+6)-4q+11)+q^{2}-6(q-1))$ (1)
$\displaystyle+(12m(m-2q+5)+14q^{2}-72(q-1))A_{2}^{\perp}$
$\displaystyle-(24m-36(q-2))A_{3}^{\perp}+24A_{4}^{\perp}]\;.$

When the weight distribution of a linear code is known, it is possible to
obtain the weight distribution of its corresponding dual code using the
Krawtchouck polynomials. Through the following, we recall such an important
mathematical tool (see, for example, [6, pp. 256]).

###### Definition 3

Let $q$, $n$, and $j$ be positive integers such that $q$ is a prime power.
Then, we define the Krawtchouck polynomial, $K_{j}^{n,q}(x)$, of degree $j$ to
be

$K_{j}^{n,q}(x):=\sum_{l=0}^{j}(-1)^{l}(q-1)^{j-l}\left(\begin{array}[]{c}x\\\
l\\\ \end{array}\right)\left(\begin{array}[]{c}n-x\\\ j-l\\\
\end{array}\right)\;.$

Let $A_{i}$ and $A_{i}^{\perp}$ be as before. Then, for a given linear code
${\cal C}$ of length $n$, the weight distribution of its dual code can be
obtained by means of

$A_{j}^{\perp}=\frac{1}{|{\cal
C}|}\sum_{i=0}^{n}A_{i}K_{j}^{n,q}(i)\;,\;\;\;0\leq j\leq n\;.$ (2)

It was shown in [12] that all irreducible cyclic codes of dimension $1$ or $2$
are either one-weight or semiprimitive two-weight irreducible cyclic codes.
Since such a result is important for this work, we recall it by means of the
following:

###### Theorem 2

Let $n$ be a positive divisor of $q^{2}-1$. Fix
$u=\gcd(q+1,\frac{q^{2}-1}{n})$. In accordance with Definition 1, let ${\cal
C}_{(n,q^{2})}$ be the irreducible cyclic code of length $n$ over ${\rm
I\\!F}_{q}$. Thus, we have the following assertions.

  1. (a)

If $1\leq u<q+1$, then ${\cal C}_{(n,q^{2})}$ is either a one-weight or a
semiprimitive two-weight irreducible cyclic code of dimension $2$, whose
weight enumerator polynomial is

$1+\frac{(q^{2}-1)}{u}z^{\frac{n(q+1-u)}{q+1}}+\frac{(q^{2}-1)(u-1)}{u}z^{n}\;.$

  2. (b)

If $u=q+1$, then ${\cal C}_{(n,q^{2})}$ is an $[n,1]$ one-weight code, whose
nonzero weight is $n$ (which is equivalent to a repetition code of length
$n$).

##  III Some preliminary results

In this section, and for the rest of the paper, we will assume that $\gamma$
is a fixed primitive element of ${\rm I\\!F}_{q^{2}}$.

The following two definitions will be important in order to achieve our goals.

###### Definition 4

Let $V=(v_{0},v_{1},\cdots,v_{n-1})$ be a vector of length $n$ over ${\rm
I\\!F}_{q}$. We define the set of symbols of $V$, $\textrm{\rm SSymb}(V)$, as
the subset of symbols of ${\rm I\\!F}_{q}$ appearing as entries in the vector
$V$. That is:

$\textrm{\rm SSymb}(V=(v_{0},v_{1},\cdots,v_{n-1})):=\\{s\in{\rm
I\\!F}_{q}\>|\>s=v_{i},\mbox{ for some }0\leq i<n\\}\;.$

###### Definition 5

Let $s\in{\rm I\\!F}_{q}$, and let $V=(v_{0},v_{1},\cdots,v_{n-1})$ be a
vector of length $n$ over ${\rm I\\!F}_{q}$. We define the number of
occurrences of the symbol $s$ in $V$, $\\#\textrm{\rm Occr}(s,V)$, as the
number of times that $s$ appears as an entry in the vector $V$. That is:

$\\#\textrm{\rm
Occr}(s,V=(v_{0},v_{1},\cdots,v_{n-1})):=|\\{i\>|\>s=v_{i},\>0\leq i<n\\}|\;.$

###### Remark 2

Note that $0\leq\\#\textrm{\rm Occr}(s,V)\leq n$. In fact, clearly,
$\\#\textrm{\rm Occr}(s,V)>0$ iff $s\in\textrm{\rm SSymb}(V)$.

The following is an easy result whose proof is given here in order to make
this paper as self-contained as possible.

###### Proposition 1

Let $l$ be an integer. If $q$ is odd, then $\textrm{\rm Tr}_{{\rm
I\\!F}_{q^{2}}/{\rm I\\!F}_{q}}(\gamma^{\frac{q+1}{2}+l(q+1)})=0$. In
addition, if $q$ is even, then $\textrm{\rm Tr}_{{\rm I\\!F}_{q^{2}}/{\rm
I\\!F}_{q}}(\gamma^{l(q+1)})=0$.

###### Proof:

First note that $\gamma^{l(q+1)}\in{\rm I\\!F}_{q}^{*}$. Thus, if $q$ is odd,
then

$\textrm{\rm Tr}_{{\rm I\\!F}_{q^{2}}/{\rm
I\\!F}_{q}}(\gamma^{\frac{q+1}{2}+l(q+1)})=\gamma^{l(q+1)}\textrm{\rm
Tr}_{{\rm I\\!F}_{q^{2}}/{\rm I\\!F}_{q}}(\gamma^{\frac{q+1}{2}})\;,$

but,

$\textrm{\rm Tr}_{{\rm I\\!F}_{q^{2}}/{\rm
I\\!F}_{q}}(\gamma^{\frac{q+1}{2}})=(\gamma^{\frac{q+1}{2}}+\gamma^{\frac{q(q+1)}{2}})=(\gamma^{\frac{q+1}{2}}+\gamma^{\frac{q^{2}-1}{2}}\gamma^{\frac{q+1}{2}})=(\gamma^{\frac{q+1}{2}}-\gamma^{\frac{q+1}{2}})=0\;.$

On the other hand, if $q$ is even, then

$\textrm{\rm Tr}_{{\rm I\\!F}_{q^{2}}/{\rm
I\\!F}_{q}}(\gamma^{l(q+1)})=\gamma^{l(q+1)}+\gamma^{l(q+1)}=0\;.$

∎

###### Remark 3

Note that in the case when $n_{1}=1$ and $n_{2}=q+1$, in Definition 2, the
codewords $c(\alpha,\beta)$, in the reducible cyclic code ${\cal
C}_{(1,q+1,q^{2})}$, are of the form:

$c(\alpha,\beta)=(\alpha+\textrm{\rm Tr}_{{\rm I\\!F}_{q^{2}}/{\rm
I\\!F}_{q}}(\beta\gamma^{(q-1)i}))_{i=0}^{q}\;,\mbox{ with }\alpha\in{\rm
I\\!F}_{q},\;\beta\in{\rm I\\!F}_{q^{2}}\;.$

In fact, in this case, it is important to keep in mind that ${\cal
C}_{(1,q+1,q^{2})}$ is a reducible cyclic code of length $q+1$ and dimension
$3$. In addition, observe that the reducible cyclic code ${\cal
C}_{(1,q+1,q^{2})}$ is the sum, as vector spaces, of the irreducible cyclic
codes ${\cal C}_{(1,q^{2})}$ and ${\cal C}_{(q+1,q^{2})}$. Lastly, note that,
owing to Part (b) of Theorem 2, ${\cal C}_{(1,q^{2})}$ is a $[1,1]$ one-weight
irreducible cyclic code, while, owing to Part (a) of the same theorem, ${\cal
C}_{(q+1,q^{2})}$ is either a one-weight or a semiprimitive two-weight
irreducible cyclic code of length $q+1$ and dimension $2$.

The following result is key to identify the number of occurrences of a given
symbol $s$ in a codeword $c(\beta)$ that belongs to an irreducible cyclic code
of the form ${\cal C}_{(q+1,q^{2})}$ (see Definition 1).

###### Proposition 2

Let $b$, $j$ and $t$ be integers such that $0<t<(q+1)$. Then, $\textrm{\rm
Tr}_{{\rm I\\!F}_{q^{2}}/{\rm
I\\!F}_{q}}(\gamma^{b}\gamma^{(q-1)j})=\textrm{\rm Tr}_{{\rm
I\\!F}_{q^{2}}/{\rm I\\!F}_{q}}(\gamma^{b}\gamma^{(q-1)(j+t)})$ iff
$(q+1)|(2j+t-b)$.

###### Proof:

$\textrm{\rm Tr}_{{\rm I\\!F}_{q^{2}}/{\rm
I\\!F}_{q}}(\gamma^{b}\gamma^{(q-1)j})=\textrm{\rm Tr}_{{\rm
I\\!F}_{q^{2}}/{\rm I\\!F}_{q}}(\gamma^{b}\gamma^{(q-1)(j+t)})$ iff

$\gamma^{(q-1)j+b}+\gamma^{q((q-1)j+b)}=\gamma^{(q-1)(j+t)+b}+\gamma^{q((q-1)(j+t)+b)}\;.$

But $\gamma^{q(q-1)x}=\gamma^{-(q-1)x}$, for all integer $x$. Therefore,

$\displaystyle\gamma^{(q-1)j+b}+\gamma^{-(q-1)j+qb}$ $\displaystyle=$
$\displaystyle\gamma^{(q-1)(j+t)+b}+\gamma^{-(q-1)(j+t)+qb}\;,$
$\displaystyle\gamma^{(q-1)j+b}-\gamma^{(q-1)(j+t)+b}$ $\displaystyle=$
$\displaystyle\gamma^{-(q-1)(j+t)+qb}-\gamma^{-(q-1)j+qb}\;,$
$\displaystyle\gamma^{(q-1)j}-\gamma^{(q-1)(j+t)}$ $\displaystyle=$
$\displaystyle\gamma^{-(q-1)(j+t)+(q-1)b}-\gamma^{-(q-1)j+(q-1)b}\;,$
$\displaystyle\gamma^{(q-1)j}(1-\gamma^{(q-1)t})$ $\displaystyle=$
$\displaystyle\gamma^{-(q-1)(j+t)+(q-1)b}(1-\gamma^{(q-1)t})\;.$

Since $0<t<(q+1)$, $(1-\gamma^{(q-1)t})\neq 0$. Therefore,

$\displaystyle\gamma^{(q-1)j}$ $\displaystyle=$
$\displaystyle\gamma^{-(q-1)(j+t)+(q-1)b}\;,$ $\displaystyle\gamma^{(q-1)2j}$
$\displaystyle=$ $\displaystyle\gamma^{(q-1)(b-t)}\;.$

Now, note that the previous equality will hold iff $2j\equiv b-t\pmod{q+1}$
iff $(q+1)|(2j+t-b)$. ∎

In the light of Remark 3, we can now describe the nature of a codeword
$c(\beta)$ that belongs to an irreducible cyclic code of the form ${\cal
C}_{(q+1,q^{2})}$.

###### Proposition 3

Let $\beta\in{\rm I\\!F}_{q^{2}}^{*}$, and let $b$ be the index of $\beta$
(that is, $\beta=\gamma^{b}$). Let $j$ be an integer. Then, for the codeword
$c(\beta)=\\{(\textrm{\rm Tr}_{{\rm I\\!F}_{q^{2}}/{\rm
I\\!F}_{q}}(\gamma^{b}\gamma^{(q-1)i}))_{i=0}^{q}\\}\in{\cal
C}_{(q+1,q^{2})}$, we have

  1. (a)

If $\gamma^{b}\gamma^{(q-1)j}\in{\rm I\\!F}_{q}^{*}$, then $\\#\textrm{\rm
Occr}(\textrm{\rm Tr}_{{\rm I\\!F}_{q^{2}}/{\rm
I\\!F}_{q}}(\gamma^{b}\gamma^{(q-1)j}),c(\beta))=1$.

  2. (b)

If $\gamma^{b}\gamma^{(q-1)j}\notin{\rm I\\!F}_{q}^{*}$, then $\\#\textrm{\rm
Occr}(\textrm{\rm Tr}_{{\rm I\\!F}_{q^{2}}/{\rm
I\\!F}_{q}}(\gamma^{b}\gamma^{(q-1)j}),c(\beta))=2$.

  3. (c)

For all $s\in{\rm I\\!F}_{q}$, $\\#\textrm{\rm Occr}(s,c(\beta))\leq 2$.

  4. (d)

Let $s\in{\rm I\\!F}_{q}^{*}$. Then,

$|\\{c(\beta)\in{\cal C}_{(q+1,q^{2})}\>|\>\\#\textrm{\rm
Occr}(s,c(\beta))=1\\}|=\left\\{\begin{array}[]{cl}\\!q+\\!1&\\!\mbox{if $q$
is odd,}\\\ \\\ \\!0&\\!\mbox{otherwise. }\end{array}\right.$

  5. (e)

Let $s\in{\rm I\\!F}_{q}$, such that $\\#\textrm{\rm Occr}(s,c(\beta))=1$.
Then, $q$ is odd iff $s\neq 0$.

  6. (f)

Let $s\in{\rm I\\!F}_{q}$, such that $\\#\textrm{\rm Occr}(s,c(\beta))=2$. If
$q$ is even, then $s\neq 0$.

###### Proof:

Parts (a) and (b): First, note that because $(q+1)|(2j+(q-1)j)$, we have
$\gamma^{b}\gamma^{(q-1)j}\in{\rm I\\!F}_{q}^{*}=\langle\gamma^{q+1}\rangle$
iff $(q+1)|((q-1)j+b)$ iff $(q+1)|(2j-b)$. Thus, if $(q+1)|(2j-b)$, then there
is no integer $0<t<(q+1)$ such that $(q+1)|(2j+t-b)$, which in turn implies,
due to Proposition 2, that there is no integer $0<t<(q+1)$ such that
$\textrm{\rm Tr}_{{\rm I\\!F}_{q^{2}}/{\rm
I\\!F}_{q}}(\gamma^{b}\gamma^{(q-1)j})=\textrm{\rm Tr}_{{\rm
I\\!F}_{q^{2}}/{\rm I\\!F}_{q}}(\gamma^{b}\gamma^{(q-1)(j+t)})$. Therefore,
$\\#\textrm{\rm Occr}(\textrm{\rm Tr}_{{\rm I\\!F}_{q^{2}}/{\rm
I\\!F}_{q}}(\gamma^{b}\gamma^{(q-1)j}),c(\beta))=1$. On the contrary, if
$(q+1)\nmid(2j-b)$, then there exists a unique integer $0<t<(q+1)$ such that
$(q+1)|(2j+t-b)$, and for such an integer $t$ we have $\textrm{\rm Tr}_{{\rm
I\\!F}_{q^{2}}/{\rm I\\!F}_{q}}(\gamma^{b}\gamma^{(q-1)j})=\textrm{\rm
Tr}_{{\rm I\\!F}_{q^{2}}/{\rm I\\!F}_{q}}(\gamma^{b}\gamma^{(q-1)(j+t)})$.
Therefore, in this case, $\\#\textrm{\rm Occr}(\textrm{\rm Tr}_{{\rm
I\\!F}_{q^{2}}/{\rm I\\!F}_{q}}(\gamma^{b}\gamma^{(q-1)j}),c(\beta))=2$.

Part (c): If $s\notin\textrm{\rm SSymb}(c(\beta))$, then, clearly,
$\\#\textrm{\rm Occr}(s,c(\beta))=0$. On the other hand, if $s\in\textrm{\rm
SSymb}(c(\beta))$, then Parts (a) and (b) show that $\\#\textrm{\rm
Occr}(s,c(\beta))$ is either $1$ or $2$.

Part (d): Suppose that $q$ is odd. Let $0\leq r<q-1$ be the unique integer
such that $2^{-1}s=\gamma^{(q+1)r}\in{\rm I\\!F}_{q}^{*}$, and observe that if
$\gamma^{b^{\prime}}\gamma^{(q-1)j}=\gamma^{(q+1)r}$, for integers $j$ and
$b^{\prime}$, then $\textrm{\rm Tr}_{{\rm I\\!F}_{q^{2}}/{\rm
I\\!F}_{q}}(\gamma^{b^{\prime}}\gamma^{(q-1)j})=2^{-1}s\textrm{\rm Tr}_{{\rm
I\\!F}_{q^{2}}/{\rm I\\!F}_{q}}(1)=s$. That is, since
$\gamma^{b^{\prime}}\gamma^{(q-1)j}\in{\rm I\\!F}_{q}^{*}$, $\\#\textrm{\rm
Occr}(s,c(\gamma^{b^{\prime}}))=1$. Then, the result follows from the fact
that for each $0\leq j\leq q$ there exists a unique integer $0\leq
b^{\prime}<q^{2}-1$ such that
$\gamma^{b^{\prime}}\gamma^{(q-1)j}=\gamma^{(q+1)r}$.

On the contrary, if $q$ is even, then Parts (a) and (b), and Proposition 1,
show that if $s\in\textrm{\rm SSymb}(c(\beta))$, then $\\#\textrm{\rm
Occr}(s,c(\beta))=1$ iff $s=0$. Thus, the result follows from the fact that it
is impossible to find a codeword $c(\beta)$ such that $s\in{\rm
I\\!F}_{q}^{*}$, and $\\#\textrm{\rm Occr}(s,c(\beta))=1$.

Parts (e) and (f): Note that $\gamma^{b}\gamma^{(q-1)j}\in{\rm I\\!F}_{q}^{*}$
iff $(q+1)|(b+(q-1)j)$. Thus, these results follow from Parts (a) and (b), and
Proposition 1. ∎

###### Remark 4

Note that the proof of the previous result ensures the existence of at least
two codewords, $c(\beta)$ and $c(\beta^{\prime})$ in ${\cal C}_{(q+1,q^{2})}$,
such that $\\#\textrm{\rm Occr}(s,c(\beta))=1$ and $\\#\textrm{\rm
Occr}(s^{\prime},c(\beta^{\prime}))=2$, for some symbols $s$ and $s^{\prime}$
such that $s\in\textrm{\rm SSymb}(c(\beta))$ and $s^{\prime}\in\textrm{\rm
SSymb}(c(\beta^{\prime}))$.

###### Example 1

Let ${\rm I\\!F}_{7}={\mathchoice{\hbox{$\sf\textstyle
Z\kern-3.99994ptZ$}}{\hbox{$\sf\textstyle
Z\kern-3.99994ptZ$}}{\hbox{$\sf\scriptstyle
Z\kern-2.10002ptZ$}}{\hbox{$\sf\scriptscriptstyle
Z\kern-0.99998ptZ$}}}_{7}=\\{0,1,\cdots,6\\}$, and ${\rm I\\!F}_{7^{2}}={\rm
I\\!F}_{7}(\gamma),\;\gamma^{2}+6\gamma+3=0$. Then, for example,
$c(\gamma^{0})=(2,3,0,4,5,4,0,3)$ and $c(\gamma^{1})=(1,1,2,5,6,6,5,2)$.
Therefore, we have $\\#\textrm{\rm Occr}(2,c(\gamma^{0}))=\\#\textrm{\rm
Occr}(5,c(\gamma^{0}))=1$, $\\#\textrm{\rm Occr}(s,c(\gamma^{0}))=2$ for all
$s\in\textrm{\rm SSymb}(c(\gamma^{0}))\setminus\\{2,5\\}$, and $\\#\textrm{\rm
Occr}(s,c(\gamma^{1}))=2$ for all $s\in\textrm{\rm SSymb}(c(\gamma^{1}))$.

###### Example 2

Let ${\rm I\\!F}_{8}=\\{\hat{0},\hat{1},\cdots,\hat{7}\\}$, where ${\rm
I\\!F}_{8}={\rm I\\!F}_{2}(\alpha),\;\alpha^{3}+\alpha+1$, and $\hat{0}:=0$,
$\hat{1}:=1$, $\hat{2}:=\alpha$, $\hat{3}:=\alpha+1$, $\hat{4}:=\alpha^{2}$,
$\hat{5}:=\alpha^{2}+1$, $\hat{6}:=\alpha^{2}+\alpha$, and
$\hat{7}:=\alpha^{2}+\alpha+1$. By taking ${\rm I\\!F}_{8^{2}}={\rm
I\\!F}_{8}(\gamma),\;\gamma^{2}+\gamma+\hat{3}=0$, we have, for example,
$c(\gamma^{0})=(\hat{0},\hat{6},\hat{2},\hat{1},\hat{4},\hat{4},\hat{1},\hat{2},\hat{6})$
and
$c(\gamma^{1})=(\hat{1},\hat{1},\hat{7},\hat{5},\hat{4},\hat{0},\hat{4},\hat{5},\hat{7})$.
Therefore, we have $\\#\textrm{\rm Occr}(\hat{0},c(\gamma^{0}))=\\#\textrm{\rm
Occr}(\hat{0},c(\gamma^{1}))=1$, while $\\#\textrm{\rm
Occr}(s,c(\gamma^{0}))=\\#\textrm{\rm Occr}(s^{\prime},c(\gamma^{1}))=2$ for
all $\hat{0}\neq s\in\textrm{\rm SSymb}(c(\gamma^{0}))$, and $\hat{0}\neq
s^{\prime}\in\textrm{\rm SSymb}(c(\gamma^{1}))$.

By means of the following two results we determine the nonzero weights in the
reducible cyclic code ${\cal C}_{(1,q+1,q^{2})}$, and also obtain the
frequency of occurrence of one of these nonzero weights.

###### Proposition 4

Let $\bar{1}=(1,1,\cdots,1)$ be the all-ones vector of length $q+1$. Then,

$|\\{w_{H}(\alpha\bar{1}+c(\beta))=q\;|\;\alpha\in{\rm
I\\!F}_{q}^{*},\beta\in{\rm I\\!F}_{q^{2}}^{*},c(\beta)\in{\cal
C}_{(q+1,q^{2})}\\}|=\left\\{\begin{array}[]{cl}\\!q^{2}\\!-\\!1&\\!\mbox{if
$q$ is odd,}\\\ \\\ \\!0&\\!\mbox{otherwise, }\end{array}\right.$

where $w_{H}(\cdot)$ stands for the usual Hamming weight function.

###### Proof:

Case 1: $q$ is odd. Let $s\in{\rm I\\!F}_{q}$, such that $\\#\textrm{\rm
Occr}(s,c(\beta))=1$. Thus, owing to Part (e) of Proposition 3, $s\neq 0$. By
considering Part (d) of such a proposition, the result now follows from the
facts that $|{\rm I\\!F}_{q}^{*}|=q-1$ and

$|\\{w_{H}((-s)\bar{1}+c(\beta))=q\;|\;\beta\in{\rm
I\\!F}_{q^{2}}^{*},c(\beta)\in{\cal C}_{(q+1,q^{2})}\\}|=q+1\;.$

Case 2: $q$ is even. In this case, Part (d) of Proposition 3 shows that

$|\\{w_{H}((-s)\bar{1}+c(\beta))=q\;|\;\beta\in{\rm
I\\!F}_{q^{2}}^{*},c(\beta)\in{\cal C}_{(q+1,q^{2})}\\}|=0\;,$

and the result follows now directly. ∎

###### Proposition 5

With our notation, ${\cal C}_{(1,q+1,q^{2})}$ is a three-weight cyclic code of
length $q+1$ and dimension $3$, whose nonzero weights are $q-1$, $q$, and
$q+1$. In addition, if $A_{q}$ denotes the number of codewords of weight $q$
in ${\cal C}_{(1,q+1,q^{2})}$, then $A_{q}=q^{2}-1$.

###### Proof:

By Definition 2, ${\cal C}_{(1,q+1,q^{2})}$ is a reducible cyclic code of
length $q+1$ and dimension $3$.

Case 1: $q$ is odd. In this case,
$u=\gcd(q+1,\frac{q^{2}-1}{q+1})=\gcd(q+1,q-1)=2$. Therefore, owing to Part
(a) of Theorem 2, ${\cal C}_{(q+1,q^{2})}$ is a semiprimitive two-weight
irreducible cyclic code of length $q+1$ and dimension $2$, whose weight
enumerator polynomial is
$1+\frac{(q^{2}-1)}{2}z^{q-1}+\frac{(q^{2}-1)}{2}z^{q+1}$. That is, the two
nonzero weights of ${\cal C}_{(q+1,q^{2})}$ are $q-1$ and $q+1$. Since ${\cal
C}_{(q+1,q^{2})}\subsetneq{\cal C}_{(1,q+1,q^{2})}$ (see Remark 3), these two
nonzero weights also belong to ${\cal C}_{(1,q+1,q^{2})}$. Now, owing to
Remark 4 and Part (e) of Proposition 3, there exist a codeword
$c(\beta)\in{\cal C}_{(q+1,q^{2})}$ such that $\\#\textrm{\rm
Occr}(s,c(\beta))=1$ for some symbol $s\neq 0$. Thus, note that
$(-s)\bar{1}+c(\beta)\in{\cal C}_{(1,q+1,q^{2})}$ and
$w_{H}((-s)\bar{1}+c(\beta))=q$. On the other hand, by means of Part (c) of
Proposition 3, we can see that the only nonzero weights of ${\cal
C}_{(1,q+1,q^{2})}$ are $q-1$, $q$, and $q+1$. Lastly, Proposition 4 shows now
that $A_{q}=q^{2}-1$.

Case 2: $q$ is even. In this case, $u=\gcd(q+1,q-1)=1$. Therefore, owing to
Part (a) of Theorem 2, ${\cal C}_{(q+1,q^{2})}$ is a one-weight irreducible
cyclic code of length $q+1$ and dimension $2$, whose nonzero weight is $q$.
This means that the weight $q$ appears in ${\cal C}_{(q+1,q^{2})}$, $q^{2}-1$
times. Now, since $\bar{1}\in{\cal C}_{(1,q+1,q^{2})}$ (see Remark 3), $q$ and
$q+1$ are two nonzero weights in ${\cal C}_{(1,q+1,q^{2})}$. But, Remark 4 and
Part (f) of Proposition 3, show that there exist a codeword $c(\beta)\in{\cal
C}_{(q+1,q^{2})}$ such that $\\#\textrm{\rm Occr}(s,c(\beta))=2$, for some
symbol $s\neq 0$. Therefore, note that $(-s)\bar{1}+c(\beta)\in{\cal
C}_{(1,q+1,q^{2})}$ and $w_{H}((-s)\bar{1}+c(\beta))=q-1$. On the other hand,
Part (c) of Proposition 3 shows that the only nonzero weights of ${\cal
C}_{(1,q+1,q^{2})}$ are $q-1$, $q$, and $q+1$. Lastly, owing to Proposition 4,
$A_{q}=q^{2}-1$. ∎

##  IV Optimal three-weight cyclic codes of dimension 3 and their duals

We are now able to present our main results.

###### Theorem 3

With our notation, ${\cal C}_{(1,q+1,q^{2})}$ is an optimal three-weight
cyclic code of length $q+1$ and dimension $3$, whose nonzero weights are
$q-1$, $q$, and $q+1$. In addition, the weight enumerator polynomial of ${\cal
C}_{(1,q+1,q^{2})}$ is

$1+\frac{q(q^{2}-1)}{2}z^{q-1}+(q^{2}-1)z^{q}+\frac{q(q-1)^{2}}{2}z^{q+1}\;.$

###### Proof:

By Proposition 5, ${\cal C}_{(1,q+1,q^{2})}$ is a three-weight cyclic code of
length $q+1$ and dimension $3$, whose nonzero weights are $q-1$, $q$, and
$q+1$.

The dimension, $k$, and minimum distance, $d$, of ${\cal C}_{(1,q+1,q^{2})}$
are $3$ and $q-1$, respectively. Therefore, a direct application of Theorem 1
shows that

$\sum_{i=0}^{2}\left\lceil\frac{q-1}{q^{i}}\right\rceil=q-1+\sum_{i=1}^{2}(1)=q-1+(2)=q+1\;.$

Consequently, ${\cal C}_{(1,q+1,q^{2})}$ is an optimal linear code in the
sense that its length, $q+1$, reaches the lower bound in such a theorem.

It is well known that the minimum Hamming distance of the dual of any nonzero
cyclic code is greater than 1 (see, for example, [13, Section V]). On the
other hand, Proposition 5 tells us that $A_{q}=q^{2}-1$. Thus, by using the
first two identities in (II), we obtain the following two linear equations:

$\displaystyle A_{q-1}+(q^{2}-1)+A_{q+1}$ $\displaystyle=$ $\displaystyle
q^{3}-1\;,$ $\displaystyle A_{q-1}(q-1)+(q^{2}-1)q+A_{q+1}(q+1)$
$\displaystyle=$ $\displaystyle(q+1)(q-1)q^{2}\;.$

The solution of such equations shows that $A_{q-1}=\frac{q(q^{2}-1)}{2}$ and
$A_{q+1}=\frac{q(q-1)^{2}}{2}$. Therefore, the weight enumerator polynomial
for ${\cal C}_{(1,q+1,q^{2})}$ is the required one. ∎

###### Theorem 4

Denote by ${\cal C}_{(1,q+1,q^{2})}^{\perp}$ the dual code of ${\cal
C}_{(1,q+1,q^{2})}$. Suppose that ${\rm I\\!F}_{q}$ is not the binary field
(that is, $q\neq 2$). Then, ${\cal C}_{(1,q+1,q^{2})}^{\perp}$ is an optimal
cyclic code of length $q+1$, dimension $q-2$, and minimum Hamming distance
$4$. In fact,

$A_{4}^{\perp}=\frac{q(q^{2}-1)(q-1)(q-2)}{24}\;.$

In addition, if $q\geq 5$, then ${\cal C}_{(1,q+1,q^{2})}^{\perp}$ is a
$(q-2)$-weight cyclic code whose weight distribution is given by

$A_{j}^{\perp}=\frac{(q^{2}-1)\left(\begin{array}[]{c}q-1\\\ j-2\\\
\end{array}\right)}{2j(j-1)q^{2}}\left[2(q-1)^{j-1}+(-1)^{j}((j-1)q((j-2)q-2)+2)\right]\;,$
(3)

for $4\leq j\leq q+1$.

###### Proof:

Clearly, ${\cal C}_{(1,q+1,q^{2})}^{\perp}$ is a cyclic code of length $q+1$
and dimension $(q+1)-3=q-2$. On the other hand, if $q\neq 2$, then the dual
code ${\cal C}_{(1,q+1,q^{2})}^{\perp}$ is not the null code $\\{0\\}$.
Therefore, when $q\neq 2$, a direct application of the last three identities
in (II), shows that $A_{2}^{\perp}=A_{3}^{\perp}=0$, and that the value of
$A_{4}^{\perp}$ is the announced one. On the other hand, the Griesmer lower
bound shows that

$\sum_{i=0}^{q-3}\left\lceil\frac{4}{q^{i}}\right\rceil=4+\sum_{i=1}^{q-3}(1)=4+(q-3)=q+1\;.$

Therefore, the dual code ${\cal C}_{(1,q+1,q^{2})}^{\perp}$, like ${\cal
C}_{(1,q+1,q^{2})}$, is an optimal cyclic code of length $q+1$. Now, through
Definition 3, it is not difficult to see that

$\displaystyle K_{j}^{q+1,q}(0)$ $\displaystyle=$
$\displaystyle\frac{q\left(\begin{array}[]{c}q-1\\\ j-2\\\
\end{array}\right)}{j(j-1)}(q^{2}-1)(q-1)^{j-1}\;,$ (6) $\displaystyle
K_{j}^{q+1,q}(q-1)$ $\displaystyle=$
$\displaystyle\frac{(-1)^{j}q\left(\begin{array}[]{c}q-1\\\ j-2\\\
\end{array}\right)}{j(j-1)}(q(j^{2}-3j+1)+1)\;,$ (9) $\displaystyle
K_{j}^{q+1,q}(q)$ $\displaystyle=$
$\displaystyle\frac{(-1)^{j}q\left(\begin{array}[]{c}q-1\\\ j-2\\\
\end{array}\right)}{j(j-1)}(1-q(j-1))\;,$ (12) $\displaystyle
K_{j}^{q+1,q}(q+1)$ $\displaystyle=$
$\displaystyle\frac{(-1)^{j}q\left(\begin{array}[]{c}q-1\\\ j-2\\\
\end{array}\right)}{j(j-1)}(q+1)\;.$ (15)

Thus, a direct substitution of the previous four expressions in (2) proves
(3). Finally, note that

$2(q-1)^{j-1}>(-1)^{j}((j-1)q((j-2)q-2)+2)\;,$

for all $q\geq 5$, and $4\leq j\leq q+1$. Therefore,
$A_{1}^{\perp}=A_{2}^{\perp}=A_{3}^{\perp}=0$ and $A_{j}^{\perp}>0$, for all
$4\leq j\leq q+1$. Consequently, ${\cal C}_{(1,q+1,q^{2})}^{\perp}$ is a
$(q-2)$-weight cyclic code if $q\geq 5$. ∎

###### Remark 5

By using (3) it is easy to obtain

$A_{5}^{\perp}=\frac{(q^{2}-1)q(q-1)(q-2)(q-3)(q-4)}{120}\;.$

Thus, note that $A_{5}^{\perp}=0$, when $q=4$. In fact, in this case, since
dimension of ${\cal C}_{(1,5,4^{2})}^{\perp}$ is $q-2=2$ and
$u=\gcd(q+1,\frac{q^{2}-1}{n})=\gcd(q+1,q-1)=1$, Theorem 2 tell us that ${\cal
C}_{(1,5,4^{2})}^{\perp}$ is a one-weight irreducible cyclic code of length 5,
whose nonzero weight is $4$. That is, ${\cal C}_{(1,q+1,q^{2})}^{\perp}$ is
not a $(q-2)$-weight cyclic code, when $q=4$.

The following are some examples of Theorems 3 and 4.

###### Example 3

Let $q=5$. Thus, by Theorems 3 and 4, we can see that both ${\cal
C}_{(1,6,5^{2})}$ and ${\cal C}_{(1,6,5^{2})}^{\perp}$ are optimal three-
weight cyclic codes of length $6$ and dimension $3$, whose weight enumerator
polynomial is

$1+60z^{4}+24z^{5}+40z^{6}\;.$

###### Example 4

Let $q=7$. Thus, by Theorem 3, we can see that ${\cal C}_{(1,8,7^{2})}$ is an
optimal three-weight cyclic code of length $8$ and dimension $3$, whose weight
enumerator polynomial is

$1+168z^{6}+48z^{7}+126z^{8}\;.$

On the other hand, by Theorem 4, ${\cal C}_{(1,8,7^{2})}^{\perp}$ is an
optimal five-weight cyclic code of length $8$ and dimension $5$, where
$A_{4}^{\perp}=420$. In fact, by means of (3), the weight enumerator
polynomial of ${\cal C}_{(1,8,7^{2})}^{\perp}$ is

$1+420z^{4}+1008z^{5}+4032z^{6}+6432z^{7}+4914z^{8}\;.$

###### Example 5

Let $q=8$. Thus, by Theorem 3, we can see that ${\cal C}_{(1,9,8^{2})}$ is an
optimal three-weight cyclic code of length $9$ and dimension $3$, whose weight
enumerator polynomial is

$1+252z^{7}+63z^{8}+196z^{9}\;.$

On the other hand, by Theorem 4, ${\cal C}_{(1,9,8^{2})}^{\perp}$ is an
optimal six-weight cyclic code of length $9$ and dimension $6$, where
$A_{4}^{\perp}=882$. In fact, by means of (3), the weight enumerator
polynomial of ${\cal C}_{(1,9,8^{2})}^{\perp}$ is

$1+882z^{4}+3528z^{5}+19992z^{6}+57456z^{7}+101493z^{8}+78792z^{9}\;.$

###### Example 6

Let $q=9$. Thus, by Theorem 3, we can see that ${\cal C}_{(1,10,9^{2})}$ is an
optimal three-weight cyclic code of length $10$ and dimension $3$, whose
weight enumerator polynomial is

$1+360z^{8}+80z^{9}+288z^{10}\;.$

On the other hand, by Theorem 4, ${\cal C}_{(1,10,9^{2})}^{\perp}$ is an
optimal seven-weight cyclic code of length $10$ and dimension $7$, where
$A_{4}^{\perp}=1680$. In fact, by means of (3), the weight enumerator
polynomial of ${\cal C}_{(1,10,9^{2})}^{\perp}$ is

$1+1680z^{4}+10080z^{5}+77280z^{6}+343680z^{7}+1036440z^{8}+1840880z^{9}+1472928z^{10}\;.$

###### Remark 6

By directly obtaining the corresponding weight distribution, the previous
numerical examples were corroborated with the help of a computer.

##  V Conclusions

By describing the number of occurrences of the symbols in the codewords of a
particular kind of one-weight and semiprimitive two-weight irreducible cyclic
codes of dimension 2 (Proposition 3), we present a new class of optimal three-
weight cyclic codes of dimension 3 (Theorem 3). Furthermore, we explicitly
determine the weight distribution for the cyclic codes in this new class and,
with the knowledge of this distribution, we study their corresponding dual
codes. As a result, we found that, except for the case $q=2$, all the dual
codes have minimum Hamming distance $4$. In consequence, since the length,
dimension and minimum Hamming distance of the dual codes are $q+1$, $q-2$, and
$4$, respectively, our last result (Theorem 4) shows that these codes are also
optimal. As an application of the Krawtchouck polynomials we obtained the
weight distribution of the dual codes, making it clear that all of them are
$(q-2)$-weight cyclic codes for $q\geq 5$. Therefore, in addition to our new
class of optimal cyclic codes, this last result gives access to an infinite
family of optimal $(q-2)$-weight cyclic codes of length $q+1$, and dimension
$q-2$, whose minimum Hamming distance is $4$. In fact, note that the
redundancy for each one of the dual codes is only $3$. However, despite this
low redundancy, any dual code is able to correct an error and detect up to two
errors.

Finally, we want to note that the dual code in Example 3 is an optimal three-
weight cyclic code of dimension 3 that is not included in the class of optimal
three-weight cyclic code studied here (the dual code is not of the form ${\cal
C}_{(1,q+1,q^{2})}$). Therefore, this example shows that the results presented
in this work are likely to be generalized.

## References

  * [1] R. Anderson, C. Ding, T. Helleseth, and T. Kl$\o$ve, “How to build robust shared control systems,” Designs, Codes Cryptogr., vol. 15, no. 2, pp. 111-124, 1998.
  * [2] A. R. Calderbank and J. M. Goethals, “Three-weight codes and association schemes,” Philips J. Res., vol. 39, nos. 4-5, pp. 143-152, 1984.
  * [3] P. Delsarte, “On subfield subcodes of Reed-Solomon codes,” IEEE Trans. Inf. Theory, vol. 21, no. 5, pp. 575-576, 1975.
  * [4] J. H. Griesmer, “A bound for error correcting codes,” IBM Journal of Res. and Dev., vol. 4, no. 5, pp. 532-542, 1960.
  * [5] Z. Heng and Q. Yue, “Several Classes of Cyclic Codes With Either Optimal Three Weights or a Few Weights,” IEEE Trans. Inf. Theory, vol. 62, no. 8, pp. 4501-4513, 2016.
  * [6] W. C. Huffman and V. Pless, Fundamentals of Error-Correcting Codes. Cambridge, U.K.: Cambridge Univ. Press, 2003.
  * [7] F. J. MacWilliams and N. J. A. Sloane, The Theory of Error-Correcting Codes. Amsterdam, The Netherlands: North-Holland, 1977.
  * [8] V. Pless, “Power moment identities on weight distributions in error-correcting codes,” Inf. Contr., vol. 6, pp. 147-152, 1962.
  * [9] B. Schmidt and C. White, “All two-weight irreducible cyclic codes?,” Finite Fields Appl., vol. 8, pp. 1-17, 2002.
  * [10] G. Solomon and J. J. Stiffler, “Algebraically punctured cyclic codes,” Inform. and Control, vol. 8, no. 2, pp. 170-179, 1965.
  * [11] G. Vega, “A characterization of a class of optimal three-weight cyclic codes of dimension 3 over any finite field,” Finite Fields Appl., vol. 42, pp. 23-38, 2016.
  * [12] G. Vega, “A characterization of all semiprimitive irreducible cyclic codes in terms of their lengths,” Applicable Algebra Eng. Commun. Computing, vol. 30, no. 5, pp. 441-452, 2019.
  * [13] J. Wolfmann, “Are 2-Weight Projective Cyclic Codes Irreducible?,” IEEE Trans. Inform. Theory, vol. 51, no. 2, pp. 733-737, 2005.