1 Introduction

Let \(\mathrm{I\!F}_q\) be the finite field with q elements. An [nl] linear code, \(\mathscr {C}\), over \(\mathrm{I\!F}_q\) is an l-dimensional subspace of \(\mathrm{I\!F}_q^n\) (see for example [4, Section 1.4]). In this context, the vectors of \(\mathscr {C}\) are called codewords. Let \(A_i\) be the number of codewords with Hamming weight i in \(\mathscr {C}\) (recall that the Hamming weight of a codeword c is the number of nonzero coordinates in c). Then, the sequence \(A_0\), \(A_1\), \(\ldots \), \(A_n\) is called the Hamming weight distribution of \(\mathscr {C},\) and the polynomial \(A_0+A_1T+\ldots +A_nT^n\) is called the Hamming weight enumerator of \(\mathscr {C}\). An N-weight code is a code such that the cardinality of the set of nonzero weights is N. That is, \(N=|\{i:A_i\ne 0,i=1,2,3,\ldots ,n\}|\).

A linear code \(\mathscr {C}\) of length n is cyclic if \((c_0,c_1,\) \(\ldots ,\) \(c_{n-1})\in \mathscr {C}\) implies \((c_{n-1},c_0,c_1,\) \(\ldots ,c_{n-2})\in \mathscr {C}\). Cyclic codes have wide applications in storage and communication systems because, unlike encoding and decoding algorithms for linear codes, encoding/decoding algorithms for cyclic codes can be implemented easily and efficiently by employing shift registers with feedback connections (see for example [6, p. 209]). As usual in cyclic codes, we always assume that the length n of any cyclic code is relatively prime to q.

By identifying any vector \((c_0,c_1,\ldots ,c_{n-1})\in \mathrm{I\!F}_q^n\) with the polynomial \(c_0+c_1x+\cdots +c_{n-1}x^{n-1}\in \mathrm{I\!F}_q[x],\) it follows that any linear code \(\mathscr {C}\) of length n over \(\mathrm{I\!F}_q\) corresponds to a subset of the residue class ring \(\mathrm{I\!F}_q[x]/\langle x^n-1\rangle \). Moreover, it is well known that the linear code \(\mathscr {C}\) is cyclic if and only if the corresponding subset is an ideal of \(\mathrm{I\!F}_q[x]/\langle x^n-1\rangle \) (see for example [5, Theorem 9.36]).

Note that every ideal of \(\mathrm{I\!F}_q[x]/\langle x^n-1\rangle \) is principal. Thus, if \(\mathscr {C}\) is a cyclic code of length n over \(\mathrm{I\!F}_q\), then \(\mathscr {C}=\langle g(x)\rangle ,\) where g(x) is a monic polynomial, such that \(g(x)\mid (x^n-1)\). This polynomial is unique, and it is called the generator polynomial of \(\mathscr {C}\) ( [6, Theorem 1, p. 190]). On the other hand, the polynomial \(h(x)=(x^n-1)/g(x)\) is referred to as the parity check polynomial of \(\mathscr {C}\). A cyclic code over \(\mathrm{I\!F}_q\) is called irreducible (reducible) if its parity check polynomial is irreducible (reducible) over \(\mathrm{I\!F}_q\).

Denote by \(w_H(\cdot )\) the usual Hamming weight function. For \(1\le b<n\), let the Boolean function \(\bar{\mathcal{Z}}:\mathrm{I\!F}_{q}^b \rightarrow \{0,1\}\) be defined by \(\bar{\mathcal{Z}}(v)=0\) iff v is the zero vector in \(\mathrm{I\!F}_{q}^b\). The b-symbol Hamming weight, \(w_b(\textbf{x})\), of \(\textbf{x}=(x_0,\cdots ,x_{n-1}) \in \mathrm{I\!F}_{q}^n\) is defined as

$$\begin{aligned} \begin{aligned} w_b({\textbf {x}})\!:=\!w_H(\bar{\mathcal {Z}}(x_0,\ldots ,x_{b-1}),\bar{\mathcal {Z}}(x_1,\ldots ,x_{b}),\cdots ,\bar{\mathcal {Z}}(x_{n-1},\ldots ,x_{b+n-2 \!\pmod {n}}))\,. \end{aligned} \end{aligned}$$

When \(b=1\), \(w_1(\textbf{x})\) is exactly the Hamming weight of \(\textbf{x}\), that is \(w_1(\textbf{x})=w_H(\textbf{x})\). For any \(\textbf{x}, \textbf{y} \in \mathrm{I\!F}_{q}^n\), we define the b-symbol distance (b-distance for short) between \(\textbf{x}\) and \(\textbf{y}\), \(d_b(\textbf{x},\textbf{y})\), as \(d_b(\textbf{x},\textbf{y}):=w_b(\textbf{x}-\textbf{y})\), and for a code \(\mathscr {C}\) (linear or not) over \(\mathrm{I\!F}_{q}\) of length n, the b-symbol minimum Hamming distance, \(d_b(\mathscr {C})\), of \(\mathscr {C}\) is defined as \(d_b(\mathscr {C}):=\hbox {min } d_b(\textbf{x},\textbf{y})\), with \(\textbf{x},\textbf{y} \in \mathscr {C}\) and \(\textbf{x} \ne \textbf{y}\). In this context we will say that \(\mathscr {C}\) is a b-symbol code with parameters \((n,M,d_b(\mathscr {C}))_q\), where \(M=|\mathscr {C}|\). Let \(A_i^{(b)}\) denote the number of codewords with b-symbol Hamming weight i in \(\mathscr {C}\). The b-symbol Hamming weight enumerator of \(\mathscr {C}\) is defined by

$$\begin{aligned} 1+A_1^{(b)}T+A_2^{(b)}T^2+\cdots +A_n^{(b)}T^n. \end{aligned}$$

Note that if \(b=1\), then the b-symbol Hamming weight enumerator of \(\mathscr {C}\) is the ordinary Hamming weight enumerator of \(\mathscr {C}\). Some contributions to the b-symbol Hamming weight enumerator of a code can be found in [3, 9, 11, 12] and the references therein.

Up to a new invariant \(\mu (b)\), the complete b-symbol weight distribution of some irreducible cyclic codes was recently obtained in [12]. The irreducible cyclic codes considered therein, belong to a particular kind of one-weight and two-weight irreducible cyclic codes that were recently characterized in terms of their lengths ([10]). Thus, the purpose of this paper is to present a generalization for the invariant \(\mu (b)\), which will allow us to obtain the b-symbol Hamming weight distributions of all one-weight and two-weight irreducible cyclic codes, excluding only the exceptional two-weight irreducible cyclic codes studied in [8].

This work is organized as follows: In Sect. 2, we fix some notation and recall some definitions and some known results to be used in subsequent sections. Section 3 is devoted to presenting preliminary results. Particularly, in this section, we give an alternative proof of an already known result which determines the weight distributions of all one-weight and two-weight semiprimitive irreducible cyclic codes. In Sect. 4, we use such alternative proof, in order to determine the b-symbol weight distributions of all one-weight and two-weight semiprimitive irreducible cyclic codes.

2 Notation, definitions and known results

Unless otherwise specified, throughout this work we will use the following:

Notation. For integers v and w, with \(\gcd (v,w)=1\), \({\text {Ord}}_v(w)\) will denote the multiplicative order of w modulo v. By using p, t, q, r, and \(\varDelta \), we will denote positive integers such that p is a prime number, \(q=p^t\) and \(\varDelta =\frac{q^r-1}{q-1}\). From now on, \(\gamma \) will denote a fixed primitive element of \(\mathrm{I\!F}_{q^r}\). Let u be an integer such that \(u|(q^r-1)\). For \(i=0,1,\ldots ,u-1\), we define \(\mathcal{C}_i^{(u,q^r)}:=\gamma ^i \langle \gamma ^u \rangle \), where \(\langle \gamma ^u \rangle \) denotes the subgroup of \(\mathrm{I\!F}_{q^r}^*\) generated by \(\gamma ^u\). The cosets \(\mathcal{C}_i^{(u,q^r)}\) are called the cyclotomic classes of order u in \(\mathrm{I\!F}_{q^r}\). For an integer u, such that \(\gcd (p,u)=1\), p is said to be semiprimitive modulo u if there exists a positive integer d such that \(u|(p^d+1)\). Additionally, we will denote by “\({\text {Tr}}_{\mathrm{I\!F}_{q^r}/\mathrm{I\!F}_q}\)" the trace mapping from \(\mathrm{I\!F}_{q^r}\) to \(\mathrm{I\!F}_q\).

Main assumption. From now on, we are going to use n and N as integers in such a way that \(nN=q^r-1\), with the important assumption that \(r={\text {Ord}}_n(q)\). Under these circumstances, observe that if \(h_N(x) \in \mathrm{I\!F}_{q}[x]\) is the minimal polynomial of \(\gamma ^{-N}\) (see for example [6, p. 99]), then, due to Delsarte’s Theorem [1], \(h_N(x)\) is parity-check polynomial of an irreducible cyclic code of length n and dimension r over \(\mathrm{I\!F}_q\).

The following gives an explicit description of an irreducible cyclic code of length n and dimension r over \(\mathrm{I\!F}_q\).

Definition 1

Let q, r, n, and N be as before. Then the set

is called an irreducible cyclic code of length n and dimension r over \(\mathrm{I\!F}_q\).

An important kind of irreducible cyclic codes are the so-called semiprimitive irreducible cyclic codes:

Definition 2

[10, Definition 4] With our current notation and main assumption, fix \(u=\gcd (\varDelta ,N)\). Then, any [nr] irreducible cyclic code over \(\mathrm{I\!F}_{q}\) is semiprimitive if \(u \ge 2\) and the prime p is semiprimitive modulo u.

Apart from a few exceptional codes, it is well known that all two-weight irreducible cyclic codes are semiprimitive. In fact, it is conjectured in [8] that the number of these exceptional codes is eleven.

The canonical additive character of \(\mathrm{I\!F}_q\) is defined as follows:

$$\begin{aligned} \chi (x):=e^{2\pi \sqrt{-1}\text {Tr}(x)/p} \ \ \ \ \hbox { for all } x \in \mathrm{I\!F}_{q} \end{aligned}$$

where “Tr" denotes the trace mapping from \(\mathrm{I\!F}_{q}\) to the prime field \(\mathrm{I\!F}_p\). Let \(a\in \mathrm{I\!F}_q\). The orthogonality relation for the canonical additive character \(\chi \) of \(\mathrm{I\!F}_q\) is given by (see for example [5, Chapter 5]):

$$\begin{aligned} \sum _{x \in \mathrm{I\!F}_{q}} \chi (ax)=\left\{ \begin{array}{cl} \;q\; &{} \hbox { if a=0,} \\ \\ \;0\; &{} \hbox { otherwise.} \end{array} \right. \end{aligned}$$

This property plays an important role in numerous applications of finite fields. Among them, this property is useful for determining the Hamming weight of a given vector over a finite field; for example if \(V=(a_0,a_1,\ldots ,a_{n-1}) \in \mathrm{I\!F}_{q}^n\), then

$$\begin{aligned} w_H(V)=n-\frac{1}{q}\sum _{i=0}^{n-1}\sum _{y \in \mathrm{I\!F}_{q}}\chi (ya_i). \end{aligned}$$
(1)

Let \(\chi '\) be the canonical additive character of \(\mathrm{I\!F}_{q^r}\) and let \(u \ge 1\) be an integer such that \(u|(q^r-1)\). For \(i=0,1,\ldots ,u-1\), the i-th Gaussian period, \(\eta _i^{(u,q^r)}\), of order u for \(\mathrm{I\!F}_{q^r}\) is defined to be

$$\begin{aligned} \eta _i^{(u,q^r)}:=\sum _{x \in \mathcal{C}_i^{(u,q^r)}} \chi '(x). \end{aligned}$$

Suppose that \(a\in \mathcal{C}_i^{(u,q^r)}\). Since \(\sum _{x \in \mathrm{I\!F}_{q^r}}\chi '(ax^u)=u\eta _i^{(u,q^r)}+1\) and \(\eta _0^{(1,q^r)}+1=0\), the following result is a direct consequence of Theorem 1 in [7]:

Theorem 1

With our notation suppose that \(rt=2sd\) and \(u | (p^d+1)\), for positive integers s, d and u. Then

$$\begin{aligned} \frac{u\eta _i^{(u,q^r)} + 1}{q^{r/2}}= \left\{ \begin{array}{cl} (-1)^{s-1}(u-1) &{} \hbox { if } i \equiv \delta \pmod {u} \,, \\ \\ (-1)^{s} &{} \hbox { if } i \not \equiv \delta \pmod {u} \,, \end{array} \right. \end{aligned}$$

where the integer \(\delta \) is defined in terms of the following two cases:

$$\begin{aligned} \begin{aligned} \delta := \left\{ \begin{array}{cl} 0\; &{}{} \text{ if } u=1; \text{ or } p=2; \text{ or } p>2 \text{ and } 2|s; \text{ or } p>2, 2 \not \mid s, \text{ and } 2|\frac{p^d+1}{u} \,, \\ {} &{}{} \\ \frac{u}{2}\; &{}{} \text{ if } p>2, 2 \not \mid s \text{ and } 2 \not \mid \frac{p^d+1}{u} \,. \end{array} \right. \end{aligned} \end{aligned}$$

Remark 1

As shown below, by means of the previous theorem, it is possible to determine, in a single result, the Hamming weight enumerator of all one-weight and semiprimitive two-weight irreducible cyclic codes.

Under certain circumstances, and for a fixed coset \(\mathcal{C}_i^{(N,q^r)}\), it is necessary to consider the set of products of the form xy, where \(x \in \mathcal{C}_i^{(N,q^r)}\) and \(y \in \mathrm{I\!F}_{q}^*\). The following result goes in this direction:

Lemma 1

[2, Lemma 5] Let N be a positive divisor of \(q^r-1\) and let i be any integer with \(0 \le i < N\). Fix \(u=\gcd (\varDelta ,N)\). We have the following multiset equality:

$$\begin{aligned} \left\{ xy: x \in \mathcal{C}_i^{(N,q^r)}, \;y \in \mathrm{I\!F}_{q}^* \right\} =\frac{(q-1)u}{N} * \mathcal{C}_i^{(u,q^r)}, \end{aligned}$$

where \(\frac{(q-1)u}{N} * \mathcal{C}_i^{(u,q^r)}\) denotes the multiset in which each element in the set \(\mathcal{C}_i^{(u,q^r)}\) appears in the multiset with multiplicity \(\frac{(q-1)u}{N}\).

The following definitions are inspired by and similar to those of [12].

Definition 3

Let b be an integer, with \(1\le b\le r\). Let \(\mathcal{P}(b)\) be the subset of cardinality \((q^b-1)/(q-1)\) in \(\mathrm{I\!F}_{q^r}^*\) defined as

$$\begin{aligned} \mathcal{P}(b):=\bigcup _{j=1}^{b-1} \{\gamma ^{(j-1)N}+x_1\gamma ^{jN}+\cdots +x_{b-j}\gamma ^{(b-1)N}: x_1,\ldots ,x_j \in \mathrm{I\!F}_q \} \cup \{\gamma ^{(b-1)N}\}. \end{aligned}$$

Remark 2

Note that \(\mathcal{P}(1)=\{1\}\).

Definition 4

Let b be as in Definition 3 and fix \(u=\gcd (\varDelta ,N)\). For \(0\le i < u\), we define \(\mu _{(i)}(b)\) as

$$\begin{aligned} \mu _{(i)}(b):=|\{ x \in \mathcal{P}(b): x \in \mathcal{C}_i^{(u,q^r)} \}|. \end{aligned}$$

Remark 3

Since \(\mathcal{C}_0^{(2,q^r)}=\{ x\in \mathrm{I\!F}_{q^r}^*: x \hbox { is a square in } \mathrm{I\!F}_{q^r}^*\}\), note that \(\mu _{(i)}(b)\) is indeed a generalization of the invariant \(\mu (b)\) in [12]. Furthermore, note that \(\mu _{(0)}(1)=1\) and \(\mu _{(i)}(1)=0\), for \(1 \le i < u\).

The following important result from [12], is key in order to achieve our goals.

Lemma 2

[12, Lemma 4.3] Let \(\mathscr {C}\) be as in Definition 1 and let \(c(a) \in \mathscr {C}\) be a codeword. Then, for any integer \(1\le b\le r\),

$$\begin{aligned} w_b(c(a))=\frac{1}{q^{b-1}}\sum _{\theta \in \mathcal{P}(b)}w_H(c(\theta a)). \end{aligned}$$

Remark 4

The previous lemma is key for us because, although the condition \(\gcd (\frac{q^r-1}{q-1},N)=2\) is one of the main assumptions in [12], Lemma 4.3 is beyond such condition. However it is important to observe that there is a small misprint in the proof of Lemma 4.3; more specifically the equality

$$\begin{aligned} n-w_1(c(a))=\sum _{x \in I} \frac{1}{q} \sum _{y\in \mathrm{I\!F}_{q}} \chi (yax), \end{aligned}$$

should be

$$\begin{aligned} n-w_1(c(a))=\sum _{x \in I} \frac{1}{q} \sum _{y\in \mathrm{I\!F}_{q}} \chi (yax^N). \end{aligned}$$

3 Preliminary results

In the light of Remark 3, the following is a generalization of [12, Lemma 2.1].

Lemma 3

Let b and \(\mu _{(i)}(b)\) be as in Definition 4. If \(b=r\) then, for any \(0\le i < u\), we have

$$\begin{aligned} \mu _{(i)}(r)=\frac{1}{u}|\mathcal{P}(b)|=\frac{\varDelta }{u}. \end{aligned}$$

Proof

Clearly

$$\begin{aligned} \mathrm{I\!F}_{q^r}^*=\bigsqcup _{x \in \mathcal{P}(b)} x\mathrm{I\!F}_{q}^*, \end{aligned}$$

where \(\sqcup \) is a disjoint union. Now, since \(u| \varDelta \) and \(\langle \gamma ^{\varDelta } \rangle =\mathrm{I\!F}_{q}^*\), \(x \in \mathcal{C}_i^{(u,q^r)}\) if and only if each element of \(x\mathrm{I\!F}_{q}^*\) is also in \(\mathcal{C}_i^{(u,q^r)}\). This implies that

$$\begin{aligned} \mu _{(i)}(r)(q-1)=\frac{q^r-1}{u}, \end{aligned}$$

which is the number of elements in \(\mathcal{C}_i^{(u,q^r)}\). This completes the proof. \(\square \)

It is already known the Hamming weight enumerator of all one-weight and semiprimitive two-weight irreducible cyclic codes over any finite field (see for example [8, 10]). By means of the following theorem we recall such a result and give an alternative proof of it. As will be clear later, this alternative proof will be important for fulfilling our goals.

Theorem 2

Let \(\mathscr {C}\) be as in Definition 1. Fix \(u=\gcd (\varDelta ,N)\). Assume that \(u=1\) or p is semiprimitive modulo u. Let d be the smallest positive integer such that \(u | (p^d+1)\) and let \(s=1\) if \(u=1\) and \(s=(rt)/(2d)\) if \(u>1\). Fix

$$\begin{aligned} W_A=\frac{n q^{r/2-1}}{\varDelta }(q^{r/2}-(-1)^{s-1}(u-1))\;\;\; \hbox { and } \;\;\;W_B=\frac{n q^{r/2-1}}{\varDelta }(q^{r/2}-(-1)^s). \end{aligned}$$

Then, \(\mathscr {C}\) is an [nr] irreducible cyclic code whose Hamming weight enumerator is

$$\begin{aligned} 1+\frac{q^r-1}{u}T^{W_A}+\frac{(q^r-1)(u-1)}{u}T^{W_B}. \end{aligned}$$
(2)

Remark 5

Note that Theorem 2 gives, in a single result, an explicit description of the Hamming weight enumerators of all one-weight (\(u=1\)) and two-weight (\(2\le u < \varDelta \)) irreducible cyclic codes, excluding only the exceptional two-weight irreducible cyclic codes studied in [8]. Therefore observe that the two-weight irreducible cyclic codes considered in [12] (\(u=\gcd (\varDelta ,N)=2\)) belong also to Theorem 2.

Proof

First note that if \(u>1\), then there must exist an integer s such that \(rt=2sd\).

For \(a \in \mathrm{I\!F}_{q^r}^*\), let \(c(a) = ({\text {Tr}}_{\mathrm{I\!F}_{q^r}/\mathrm{I\!F}_q}(a \gamma ^{Ni}))_{i=0}^{n-1} \in \mathscr {C}\). Let \(\chi \) and \(\chi '\) be the canonical additive characters of \(\mathrm{I\!F}_{q}\) and \(\mathrm{I\!F}_{q^r}\), respectively. Thus, by the orthogonality relation for the character \(\chi \) (see (1)) the Hamming weight of the codeword c(a), \(w_H(c(a))\), is

where the last equality holds by Lemma 1. Now, suppose that \(a \in \mathcal{C}_i^{(u,q^r)}\) for some \(0\le i < u\). Thus

$$\begin{aligned} w_H(c(a))= & {} n-\frac{n}{q}-\frac{(q-1)}{qN}u \eta _i^{(u,q^r)}\\= & {} \frac{n}{\varDelta q}(q^r-1)-\frac{n}{\varDelta q}u \eta _i^{(u,q^r)} \\= & {} \frac{nq^{r-1}}{\varDelta }-\frac{n}{\varDelta q}(u \eta _i^{(u,q^r)}+1)\\= & {} \frac{nq^{r-1}}{\varDelta }-\frac{n q^{r/2-1}}{\varDelta }\frac{(u\eta _i^{(u,q^r)} + 1)}{q^{r/2}}\\= & {} \frac{n q^{r/2-1}}{\varDelta }(q^{r/2}-\frac{u\eta _i^{(u,q^r)} + 1}{q^{r/2}}). \end{aligned}$$

Let \(\delta \) be as in Theorem 1 and observe that \(i \equiv \delta \pmod {u}\) iff \(a \in \mathcal{C}_{\delta }^{(u,q^r)}\). Therefore, owing to Theorem 1, we have

$$\begin{aligned} \begin{aligned} w_H(c(a))= \left\{ \begin{array}{cl} W_A\; &{}{} \text{ if } a \in \mathcal {C}_{\delta }^{(u,q^r)}\,, \\ {} &{}{} \\ W_B\; &{}{} \text{ if } a \in \mathrm {I\!F}_{q^r}^* \setminus \mathcal {C}_{\delta }^{(u,q^r)}\,. \end{array} \right. \end{aligned} \end{aligned}$$
(3)

The result now follows from the fact that \(|\mathcal{C}_{\delta }^{(u,q^r)}|=\frac{q^r-1}{u}\) and \(|\mathrm{I\!F}_{q^r}^* {\setminus }\mathcal{C}_{\delta }^{(u,q^r)}|=\frac{(q^r-1)(u-1)}{u}\). \(\square \)

4 The b-symbol weight distribution of all one-weight and two-weight semiprimitive irreducible cyclic codes

We are now in conditions to present our main results.

Theorem 3

Assume the same notation and assumptions as in Theorem 2. Let \(\mathcal{P}(b)\), \(\mu _{(i)}(b)\), and \(\delta \) be as before. For \(0 \le i < u\) and \(1 \le b \le r\), let

$$\begin{aligned} \begin{aligned} W_i^{(b)} = \frac{(q-1)q^{r/2-b}}{N}\left[ |\mathcal {P}(b)|\left( q^{r/2}-(-1)^s\right) +(-1)^s u\mu _{((\delta -i)\!\pmod {u})}(b)\right] \end{aligned} \end{aligned}$$
(4)

Then, the b-symbol Hamming weight enumerator of \(\mathscr {C}\) is

$$\begin{aligned} A(T)=1+\frac{q^r-1}{u}\sum _{i=0}^{u-1}T^{W_i^{(b)}}. \end{aligned}$$
(5)

Proof

Let \(a\in \mathrm{I\!F}_{q^r}^*\) and let \(c(a) \in \mathscr {C}\). Let \(W_A\) and \(W_B\) be as in Theorem 2 and suppose that \(a\in \mathcal{C}_i^{(u,q^r)}\), for some \(0 \le i < u\). Thus, from (3), \(w_H(c(\theta a))=W_A\) iff \(\theta a \in \mathcal{C}_\delta ^{(u,q^r)}\) iff \(\theta \in \mathcal{C}_{(\delta -i)\!\!\pmod {u}}^{(u,q^r)}\). But there are exactly \(\mu _{((\delta -i)\!\!\pmod {u})}(b)\) elements \(\theta \) in \(\mathcal{P}(b)\) that satisfy the condition \(\theta \in \mathcal{C}_{(\delta -i)\!\!\pmod {u}}^{(u,q^r)}\). Therefore, owing to Lemma 2, \(w_b(c(a))=W_i^{(b)}\) where

$$\begin{aligned} \begin{aligned} W_i^{(b)}=\frac{1}{q^{b-1}}\left[ \mu _{((\delta -i)\!\pmod {u})}(b)W_A+\left( |\mathcal {P}(b)|-\mu _{((\delta -i)\!\pmod {u})}(b)\right) W_B \right] . \end{aligned} \end{aligned}$$

Hence, (4) follows by considering the explicit values of \(W_A\) and \(W_B\) in Theorem 2. Finally, the b-symbol Hamming weight enumerator of \(\mathscr {C}\) follows from (3) and from the fact that \(|\mathcal{C}_i^{(u,q^r)}|=\frac{q^r-1}{u}\), for any \(0\le i < u\). \(\square \)

Note that the previous theorem is also valid for \(b=1\). In fact, in this case, the ordinary Hamming weight enumerator in (2) is exactly the same as the 1-symbol Hamming weight enumerator of (5) (take into consideration Remarks 2 and 3). Therefore we see that Theorem 3 not only simplifies and generalizes [12, Corollary 3.1] but also generalizes Theorem 2.

Example 1

The following are some examples of Theorem 3.

  1. (a)

    Let \((q,r,N,b)=(3,4,2,3)\). Thus \(u=\gcd (\varDelta ,N)=2\), \(s=2\), \(\delta =0\), and \(|\mathcal{P}(b)|=q^2+q+1=13\). Since \(\mu _{(0)}(b)=8\) (see [12, Example 2.3]), \(\mu _{(1)}(b)=|\mathcal{P}(b)|-\mu _{(0)}(b)=5\). Therefore, owing to Theorems 2 and 3, \(W_A=30\), \(W_B=24\), \(W_0^{(3)}=40\), \(W_1^{(3)}=38\), and \(\mathscr {C}\) is a \([40,4]_3\) irreducible cyclic code whose ordinary and 3-symbol Hamming weight enumerators are \(1+40T^{24}+40T^{30}\) and \(1+40T^{38}+40T^{40}\), respectively.

  2. (b)

    Let \((q,r,N,b)=(2,4,3,2)\). Thus \(u=\gcd (\varDelta ,N)=3\), \(s=2\), \(\delta =0\), and \(|\mathcal{P}(b)|=q+1=3\). We take \(\mathrm{I\!F}_{16}=\mathrm{I\!F}_2(\gamma )\) with \(\gamma ^4+\gamma +1=0\). Hence \(\mathcal{P}(b)=\{1=\gamma ^0,\gamma ^3,1+\gamma ^3=\gamma ^{14}\}\). This means that \(\mu _{(0)}(b)=2\), \(\mu _{(1)}(b)=0\), and \(\mu _{(2)}(b)=1\). Therefore, owing to Theorems 2 and 3, \(W_A=4\), \(W_B=2\), \(W_0^{(2)}=5\), \(W_1^{(2)}=4\), \(W_2^{(2)}=3\), and \(\mathscr {C}\) is a \([5,4]_2\) irreducible cyclic code whose ordinary and 2-symbol Hamming weight enumerators are \(1+10T^{2}+5T^{4}\) and \(1+5(T^{3}+T^{4}+T^{5})\), respectively.

  3. (c)

    Let \((q,r,N,b)=(4,3,9,2)\). Thus \(u=\gcd (\varDelta ,N)=3\), \(s=3\), \(\delta =0\), and \(|\mathcal{P}(b)|=q+1=5\). Let \(\mathrm{I\!F}_{4}=\mathrm{I\!F}_2(\alpha )\) with \(\alpha ^2+\alpha +1=0\). We take \(\mathrm{I\!F}_{64}=\mathrm{I\!F}_4(\gamma )\) with \(\gamma ^3+\gamma ^2+\gamma +\alpha =0\). Hence \(\mathcal{P}(b)=\{1=\gamma ^0,\gamma ^9,1+\gamma ^9=\gamma ^{27},1+\alpha \gamma ^9=\gamma ^{5},1+\alpha ^2\gamma ^9=\gamma ^{40}\}\). This means that \(\mu _{(0)}(b)=3\), \(\mu _{(1)}(b)=1\), and \(\mu _{(2)}(b)=1\). Therefore, owing to Theorems 2 and 3, \(W_A=4\), \(W_B=6\), \(W_0^{(2)}=6\), \(W_1^{(2)}=W_2^{(2)}=7\), and \(\mathscr {C}\) is a \([7,3]_4\) irreducible cyclic code whose ordinary and 2-symbol Hamming weight enumerators are \(1+21T^{4}+42T^{6}\) and \(1+21T^{6}+42T^{7}\), respectively.

  4. (d)

    Let \((q,r,N,b)=(5,5,4,3)\). Thus \(u=\gcd (\varDelta ,N)=1\) and \(|\mathcal{P}(b)|=\mu _{(0)}(b)=q^2+q+1=31\). Therefore, owing to Theorems 2 and 3, \(W_A=625\), \(W_0^{(3)}=775\), and \(\mathscr {C}\) is a \([781,5]_5\) one-weight irreducible cyclic code whose ordinary and 3-symbol Hamming weight enumerators are \(1+3124T^{625}\) and \(1+3124T^{775}\), respectively.

Remark 6

With the help of a C program, the previous numerical examples were corroborated. Such C program is available via email upon request.

As Example 1-(d) has shown, it is quite easy to obtain the b-symbol Hamming weight enumerator of a one-weight irreducible cyclic code (that is, when \(u=1\)). The following result shows it in the general case.

Theorem 4

Assume the same notation as in Theorem 3. If \(u=\gcd (\varDelta ,N)=1\), then, for any \(1\le b\le r\), the b-symbol Hamming weight enumerator of \(\mathscr {C}\) is

$$\begin{aligned} A(T)=1+(q^r-1)T^{\frac{q^r-q^{r-b}}{N}}. \end{aligned}$$

Proof

If \(u=1\), then \(\mu _{(0)}(b)=|\mathcal{P}(b)|=\frac{q^b-1}{q-1}\). Thus the result now follows from (4). \(\square \)

Remark 7

If \(\mathscr {C}\) is an \((n,M,d_b(\mathscr {C}))_q\) b-symbol code, with \(b\le d_b(\mathscr {C})\le n\), then Ding et al. [3] established the Singleton-type bound \(M\le q^{n-d_b(\mathscr {C})+b}\). Therefore, an \((n,M,d_b(\mathscr {C}))_q\) b-symbol code \(\mathscr {C}\) with \(M=q^{n-d_b(\mathscr {C})+b}\) is called a maximum distance separable (MDS for short) b-symbol code.

Similar to Theorem 3.3 in [12] we also have:

Theorem 5

Let \(\mathscr {C}\) be as in Definition 1. Let \(a\in \mathrm{I\!F}_{q^r}^*\) and consider the codeword \(c(a)=({\text {Tr}}_{\mathrm{I\!F}_{q^r}/\mathrm{I\!F}_q}(a \gamma ^{Ni}))_{i=0}^{n-1}\) in \(\mathscr {C}\). Then

$$\begin{aligned} w_r(c(a))=n, \end{aligned}$$
(6)

and \(\mathscr {C}\) is an MDS b-symbol code.

Proof

Suppose that \(a\in \mathcal{C}_i^{(u,q^r)}\) for some \(0 \le i < u\). Thus, by the proof of Theorem 3, \(w_r(c(a))=W_i^{(r)}\) where

$$\begin{aligned} \begin{aligned} W_i^{(r)} = \frac{(q-1)q^{r/2-r}}{N}\left[ |\mathcal {P}(r)|\left( q^{r/2}-(-1)^s\right) +(-1)^s u\mu _{((\delta -i)\!\pmod {u})}(r)\right] \end{aligned} \end{aligned}$$

But, owing to Lemma 3, \(\mu _{((\delta -i)\!\pmod {u})}(r)=\frac{\varDelta }{u} \). On the other hand, \(|\mathcal{P}(r)|=\varDelta =\frac{q^r-1}{q-1}\) and \(n=\frac{q^r-1}{N}\). Thus, (6) now follows. Finally, since \(d_b(\mathscr {C})=n\) and \(|\mathscr {C}|=q^r\), \(\mathscr {C}\) is an MDS b-symbol code by Remark 7. \(\square \)