1 Introduction

Recall that an [nld] linear code \({\mathcal {C}}\) over the finite field \({\mathbb {F}}_{p}\) is a linear subspace of \({\mathbb {F}}_{p}^{n}\) with dimension l and minimum Hamming distance d, where p is a prime. Let \(A_{i}\) denote by the number of codewords in \({\mathcal {C}}\) with Hamming weight i in a code \({\mathcal {C}}\) of length n, the weight enumerator of \({\mathcal {C}}\) is defined by

$$\begin{aligned} 1+A_{1}z+A_{2}z^{2}+\cdots +A_{n}z^{n}. \end{aligned}$$

The sequence \((1, A_{1}, A_{2},\ldots , A_{n})\) is called the weight distribution of the code \({\mathcal {C}}\), which is a very important parameter of the code. For instance, the error correcting capability of a code is closely related to its weight distribution. In addition, the weight distribution of a code also allows the computation of the error probability of error detection and correction. Thus, it is important to study the weight distribution of a linear code, both in theory and applications.

An [nk] linear code \({\mathcal {C}}\) is called cyclic over \({\mathbb {F}}_{p}\) if for any \((c_{0}, c_{1}, \ldots , c_{n-1}) \in {\mathcal {C}}\), also \((c_{n-1}, c_{0}, \ldots , c_{n-2}) \in {\mathcal {C}}\). It is well-known that a linear code \({\mathcal {C}}\) in \({\mathbb {F}}_{p}^{n}\) is cyclic if and only if \({\mathcal {C}}\) is an ideal of the polynomial residue class ring \({\mathbb {F}}_{p}[x]/(x^{n}-1)\). Since \({\mathbb {F}}_{p}[x]/(x^{n}-1)\) is a principal ideal ring, every cyclic code corresponds to a principal ideal (g(x)) of the multiples of a polynomial g(x) which is the monic polynomial of lowest degree in the ideal. This polynomial g(x) is called the generator polynomial, and \(h(x)=(x^{n}-1)/g(x)\) is called the parity-check polynomial of the code \({\mathcal {C}}\). We also recall that a cyclic code is called irreducible if its parity-check polynomial is irreducible over \({\mathbb {F}}_{p}\), otherwise, it is called reducible. A cyclic code over \({\mathbb {F}}_{p}\) is said to have t zeros if all the zeros of the generator polynomial of the code form t conjugate classes, or equivalently, the generator polynomial has t irreducible factors over \({\mathbb {F}}_{p}\).

Cyclic codes have wide applications in both storage and communication systems. Moreover, cyclic codes are applied in association schemes [3] and secret schemes [4]. Therefore, determining the weight enumerator of a cyclic code is an important research object in coding theory. But the weight distribution is known for only a few special classes. For example, the weight distribution of some irreducible cyclic codes has been studied in [1, 2, 5, 6, 20]. For cyclic codes with two zeros, the weight distribution is known in special cases [7, 8, 10, 12, 18, 22, 24, 26]. Studies for other cyclic codes refer to [9, 11, 13, 14, 17, 23, 27, 28, 30, 31].

Throughout this paper, let mk and d be positive integers such that \(2 \le k\le \frac{m+1}{2}\) and \(\hbox {gcd}(m,d)=1\). Let p be an odd prime and \(\pi \) be a primitive element of the finite field \({\mathbb {F}}_{p^{m}}\). For \(j=0,1,\ldots ,k-1\), let \(h_{j}(x)\) and \(h_{-j}(x)\) be the minimal polynomials of \(\pi ^{-(p^{jd}+1)/2}\) and \(-\pi ^{-(p^{jd}+1)/2}\) over \({\mathbb {F}}_{p}\), respectively. It is easy to check that \(h_{j_1}(x)\) and \(h_{j_2}(x)\) are polynomials of degree m and are pairwise distinct, for \(j_1,j_2 \in \{\pm 0,\pm 1,\ldots , \pm (k-1)\}\). The cyclic codes over \({\mathbb {F}}_{p}\) with parity-check polynomial \(h_{0}(x)h_{1}(x)\) have been extensively studied in [4, 16, 21, 25]. Zhou and Ding [29] proved that the cyclic codes over \({\mathbb {F}}_{p}\) with parity-check polynomial \(h_{-0}(x)h_{1}(x)\) have three nonzero weights, and determined their weight distributions. In [15], it was proved that the cyclic codes over \({\mathbb {F}}_{p}\) with parity-check polynomial \(h_{0}(x)h_{-0}(x)h_{1}(x)\) have six nonzero weights and their weight distributions were determined as well.

General cases are more interesting. Let \({\mathcal {C}}_{m,d,2k}\) and \({\mathcal {C}}_{m,d,2k-1}\) be the cyclic codes with parity-check polynomial \(\prod _{j=0}^{k-1}h_{j}(x)h_{-j}(x)\) and \(h_{k-1}(x)\prod _{j=0}^{k-2}h_{j}(x)h_{-j}(x)\), respectively. In this paper, the weight enumerator of the cyclic code \({\mathcal {C}}_{m,d,2k}\) is determined as following.

Theorem 1.1

Let md and k be positive integers such that \(2 \le k\le \frac{m+1}{2}\) and \((m,d)=1\). Then \({\mathcal {C}}_{m,d,2k}\) is a cyclic code over \({\mathbb {F}}_{p}\) with parameters \([p^{m}-1, 2km, \frac{1}{2}(p-1)(p^{m-1}-p^{[\frac{m}{2}]-2+k})]\). Furthermore, the weight enumerator of \({\mathcal {C}}_{m,d,2k}\) is \((\alpha _k(z^{\frac{1}{2}}))^2\), where \(\alpha _k(z)\) is determined in Theorem 2.1 (details in Sect. 2).

If \(2\not \mid \frac{m}{gcd(m,k-1)}\), the weight enumerator of the cyclic code \({\mathcal {C}}_{m,d,2k-1}\) is also determined as following.

Theorem 1.2

Let m and d be positive integers such that \(2\not \mid \frac{m}{gcd(m,k-1)}\) and \((m,d)=1\), where k is a positive integer satisfying \(3 \le k\le \frac{m+1}{2}\). Then \({\mathcal {C}}_{m,d,2k-1}\) is a cyclic code over \({\mathbb {F}}_{p}\) with parameters \([p^{m}-1, (2k-1)m, \frac{1}{2}(p-1)(p^{m-1}-p^{[\frac{m}{2}]-3+k})]\). Furthermore, the weight enumerator of \({\mathcal {C}}_{m,d,2k-1}\) is

$$\begin{aligned} \left( \alpha _{k-1}\left( z^\frac{1}{2}\right) \right) ^2+\frac{1}{p^m-1}{\left( \alpha _{k}\left( z^\frac{1}{2}\right) -\alpha _{k-1}\left( z^\frac{1}{2}\right) \right) }^2, \end{aligned}$$

where \(\alpha _k(z)\) is determined in Theorem 2.1 (details in Sect. 2).

Remark

\({\mathcal {C}}_{m,d,2k-1}\) in the case of \(k=2\) has been studied in [15], and the minimum distance has different expression between cases of \(k=2\) and \(3 \le k \le \frac{m+1}{2}\), therefore, only the case of \(3 \le k \le \frac{m+1}{2}\) is presented here.

2 Preliminaries

In this section, we will introduce a result by Kai-Uwe Schmidt [19]. We need the Gaussian binomial coefficients, which are defined by

$$\begin{aligned} \left( {\begin{array}{c}n\\ s\end{array}}\right) _{q}=\prod _{t=0}^{s-1}(q^n-q^t)/(q^s-q^t). \end{aligned}$$

For \(j=0,1,\ldots ,k-1\), let \(H_j(x)\) be the minimal polynomials of \(\pi ^{-(p^{jd}+1)}\) over \({\mathbb {F}}_{p}\), respectively. Let \(\widetilde{{\mathcal {C}}}_{m,d,k}\) be the cyclic code over \({\mathbb {F}}_{p}\) with parity-check polynomial \(\prod _{j=0}^{k-1}H_j(x)\). Then it can be expressed as

$$\begin{aligned} \widetilde{{\mathcal {C}}}_{m,d,k}=\Big \{{\mathbf {c}}_{(u_0,u_1,\ldots ,u_{k-1})}: (u_{0},u_{1},\ldots , u_{k-1}) \in {\mathbb {F}}^k_{p^{m}}\Big \}, \end{aligned}$$

where

$$\begin{aligned} {\mathbf {c}}_{(u_0,u_1,\ldots ,u_{k-1})}=\left( Tr\left( \sum _{j=0}^{k-1}u_j\pi ^{(p^{jd}+1)t}\right) \right) _{t=0}^{p^{m}-2}, \end{aligned}$$

and \(Tr(\cdot )\) is the trace function from \({\mathbb {F}}_{p^m}\) to \({\mathbb {F}}_{p}. \widetilde{{\mathcal {C}}}_{m,d,k}\) has length \(p^m-1\) and dimension km. Moreover, the weight enumerator of \(\widetilde{{\mathcal {C}}}_{m,d,k}\), denoted by \(\alpha _{k}(z)\), is determined. We have the following result.

Theorem 2.1

[19] We have, \(\alpha _{k}(z)=1+\sum _{i,\tau }a_{i,\tau }z^{w_{i,\tau }}\), where \(m-2k+2 \le i \le m, \tau =1\) or \(-1\) and

$$\begin{aligned} w_{i,\tau }= {\left\{ \begin{array}{ll} p^{m-1}(p-1) &{} for \quad odd\ i,\\ \left( p^{m-1}-\tau \eta (-1)^{i/2}p^{m-i/2-1}\right) (p-1) &{} for \quad even\ i. \end{array}\right. } \end{aligned}$$

\(\eta \) is the quadratic character of \({\mathbb {F}}_{p}\). If m is odd,

$$\begin{aligned} \begin{aligned}&a_{2u-1,\tau }=\frac{1}{2}\left( {\begin{array}{c}\frac{m-1}{2}\\ u-1\end{array}}\right) _{p^2}\sum _{j=0}^{k+u-\frac{m+3}{2}}(-1)^jp^{j(j-1)}\left( {\begin{array}{c}u\\ j\end{array}}\right) _{p^2}\left( p^{\left( k+u-j-\frac{m+1}{2}\right) m}-1\right) ,\\&a_{2u,\tau }=\frac{1}{2}\left( p^{2u}+\tau \eta (-1)^{u}p^u\right) \left( {\begin{array}{c}\frac{m-1}{2}\\ u\end{array}}\right) _{p^2}\sum _{j=0}^{k+u-\frac{m+3}{2}}(-1)^jp^{j(j-1)}\left( {\begin{array}{c}u\\ j\end{array}}\right) _{p^2}\left( p^{(k+u-j-\frac{m+1}{2})m}-1\right) .\\ \end{aligned} \end{aligned}$$

If m is even,

$$\begin{aligned} \begin{aligned} a_{2u-1,\tau }=&\,\frac{1}{2}(p^{2u}-1)\left( {\begin{array}{c}\frac{m}{2}\\ u\end{array}}\right) _{p^2}\sum _{j=0}^{k+u-\frac{m+4}{2}}(-1)^jp^{j(j-1)}\left( {\begin{array}{c}u-1\\ j\end{array}}\right) _{p^2}p^{mk+2j-(m+1)(\frac{m+2}{2}+j-u)},\\ a_{2u,\tau }=&\,\frac{1}{2}\left( {\begin{array}{c}\frac{m}{2}\\ u\end{array}}\right) _{p^2}\sum _{j=0}^{k+u-\frac{m+2}{2}}(-1)^jp^{j(j-1)}\left( {\begin{array}{c}u\\ j\end{array}}\right) _{p^2}\Big (p^{mk+2j-(m+1)(\frac{m}{2}+j-u)}-1\Big )\\&+\frac{\tau }{2}\eta (-1)^{u}p^u\left( {\begin{array}{c}\frac{m}{2}\\ u\end{array}}\right) _{p^2}\sum _{j=0}^{k+u-\frac{m+2}{2}}(-1)^jp^{j(j-1)}\left( {\begin{array}{c}u\\ j\end{array}}\right) _{p^2}\Big (p^{m(k-1)-(m-1)(\frac{m}{2}+j-u)}-1\Big ).\\ \end{aligned} \end{aligned}$$

3 The weight enumerator of \({\mathcal {C}}_{m,d,2k}\)

Theorem 1.1 can be proved as following. Obviously, \({\mathcal {C}}_{m,d,2k}\) has length \(p^{m}-1\) and dimension 2km. Also, it can be expressed as

$$\begin{aligned} {\mathcal {C}}_{m,d,2k}=\Big \{{\mathbf {c}}_{(a_{0},a_{1},\ldots , a_{k-1}, b_{0},b_{1},\ldots , b_{k-1})}: a_{0},\ldots , a_{k-1}, b_{0},\ldots , b_{k-1} \in {\mathbb {F}}_{p^{m}}\Big \}, \end{aligned}$$

where

$$\begin{aligned} {\mathbf {c}}_{(a_{0},a_{1},\ldots , a_{k-1}, b_{0},b_{1},\ldots , b_{k-1})}=\left( Tr\left( \sum _{j=0}^{k-1}\left( a_j\left( \pi ^{(p^{jd}+1)/2}\right) ^t+b_j\left( -\pi ^{(p^{jd}+1)/2}\right) ^t\right) \right) \right) _{t=0}^{p^{m}-2}. \end{aligned}$$

Let \(\lambda \) be a fixed nonsquare element in \({\mathbb {F}}_{p^{m}}\).

The weight of the codeword \({\mathbf {c}}_{(a_{0},a_{1},\ldots , a_{k-1}, b_{0},b_{1},\ldots , b_{k-1})}=(c_{0}, c_{1},\ldots , c_{p^{m}-2})\) in \({\mathcal {C}}_{m,d,2k}\) is given by

$$\begin{aligned} \begin{aligned}&W({\mathbf {c}}_{(a_{0},a_{1},\ldots , a_{k-1}, b_{0},b_{1},\ldots , b_{k-1})})\\&= \#\{0\le t\le p^{m}-2: c_{t}\ne 0\}\\&= \#\left\{ 0\le t\le p^{m}-2, t\ even: Tr\left( \sum _{j=0}^{k-1}(a_j+b_j)(\pi ^t)^{(p^{jd}+1)/2}\right) \ne 0\right\} \\&\quad +\#\left\{ 0\le t\le p^{m}-2, t\ odd: Tr\left( \sum _{j=0}^{k-1}(a_j-b_j)(\pi ^t)^{(p^{jd}+1)/2}\right) \ne 0\right\} \\&=\frac{1}{2}\left( \#\left\{ 0\le t\le p^{m}-2 : Tr\left( \sum _{j=0}^{k-1}(a_j+b_j)(\pi ^t)^{p^{jd}+1}\right) \ne 0\right\} \right. \\&\quad \left. +\,\#\left\{ 0\le t\le p^{m}-2 : Tr\left( \sum _{j=0}^{k-1}(a_j-b_j)\lambda ^{(p^{jd}+1)/2} (\pi ^t)^{p^{jd}+1}\right) \ne 0\right\} \right) \\&=\frac{1}{2}\left( W\left( {\mathbf {c}}_{(a_0+b_0,a_1+b_1,\ldots ,a_{k-1}+b_{k-1})}\right) \right. \\&\quad \left. +W\left( {\mathbf {c}}_{\left( (a_0-b_0)\lambda ,(a_1-b_1)\lambda ^{(p^d+1)/2},\ldots ,(a_{k-1}-b_{k-1})\lambda ^{(p^{(k-1)d}+1)/2}\right) }\right) \right) ,\\ \end{aligned} \end{aligned}$$

where \({\mathbf {c}}_{(a_0+b_0,a_1+b_1,\ldots ,a_{k-1}+b_{k-1})}\) and \({\mathbf {c}}_{((a_0-b_0)\lambda ,(a_1-b_1)\lambda ^{(p^d+1)/2},\ldots ,(a_{k-1}-b_{k-1})\lambda ^{(p^{(k-1)d}+1)/2})}\) are codewords in \(\widetilde{{\mathcal {C}}}_{m,d,k}\). Notice that the map \({\mathcal {C}}_{m,d,2k}\rightarrow \widetilde{{\mathcal {C}}}_{m,d,k} \times \widetilde{{\mathcal {C}}}_{m,d,k}\),

$$\begin{aligned} (a_0,\ldots ,b_{k-1})\mapsto \left( (a_0+b_0,\ldots ,a_{k-1}+b_{k-1}),\big ((a_0-b_0)\lambda ,\ldots ,(a_{k-1}-b_{k-1})\lambda ^{(p^{(k-1)d}+1)/2}\big )\right) \end{aligned}$$

is bijective, we conclude that the weight enumerator of the code \({\mathcal {C}}_{m,d,2k}\) is

$$\begin{aligned} \sum _{a \in {\mathcal {C}}}\sum _{b \in {\mathcal {C}}}z^{(W(a)+W(b))/2}, \end{aligned}$$

where \({\mathcal {C}}=\widetilde{{\mathcal {C}}}_{m,d,k}\). This is easily seen to be equal to

$$\begin{aligned} \left( \sum _{c \in {\mathcal {C}}}z^{W(c)/2}\right) ^2, \end{aligned}$$

which is \((\alpha _k\left( z^\frac{1}{2}\right) )^2\). Theorem 1.1 is proved.

4 The weight enumerator of \({\mathcal {C}}_{m,d,2k-1}\) for odd \(\frac{m}{gcd(m,k-1)}\)

Let \({\mathcal {C}}_{m,d,2k-1}\) be the cyclic code defined in Sect. 1. We shall prove Theorem 1.2 in this section, assuming \(2\not \mid \frac{m}{gcd(m,k-1)}\). There is a partition of cyclic code \(\widetilde{{\mathcal {C}}}_{m,d,k}\)

$$\begin{aligned} \widetilde{{\mathcal {C}}}_{m,d,k}=\bigcup _{v\in {\mathbb {F}}_{p^{m}} }{\mathcal {C}}_{k-1,v}. \end{aligned}$$

For each \(v\in {\mathbb {F}}_{p^{m}}, {\mathcal {C}}_{k-1,v}\) is a set of codewords and it can be expressed as

$$\begin{aligned} {{\mathcal {C}}_{k-1,v}}=\{{\mathbf {c}}_{(u_0,u_1,\ldots ,u_{k-2},v)}: u_{0},u_{1},\ldots , u_{k-2} \in {\mathbb {F}}_{p^{m}}\}, \end{aligned}$$

where

$$\begin{aligned} {\mathbf {c}}_{(u_0,u_1,\ldots ,u_{k-2},v)}=\left( Tr\left( \left( \sum _{j=0}^{k-2}u_j\pi ^{(p^{jd}+1)t}\right) +v\pi ^{\left( p^{(k-1)d}+1\right) t}\right) \right) _{t=0}^{p^{m}-2}. \end{aligned}$$

We denote \(\alpha _{k-1,v}(z)\) by the weight enumerator of \({\mathcal {C}}_{k-1,v}\). Notice \({\mathcal {C}}_{k-1,0}=\widetilde{{\mathcal {C}}}_{m,d,k-1}\), hence \(\alpha _{k-1,0}(z)=\alpha _{k-1}(z)\). If \(v\ne 0\), we have the following lemma.

Lemma 4.1

For any \(v \in {\mathbb {F}}^*_{p^{m}}\), we have \(\alpha _{k-1,v}(z)=\alpha _{k-1,1}(z)\).

Proof

Let \(\zeta _p\) be a primitive pth root of unity. In terms of exponential sums, the weight of the codeword \({\mathbf {c}}_{(u_0,u_1,\ldots ,u_{k-2},v)}=(c_0,c_1,\ldots ,c_{p^m-2})\) in \({\mathcal {C}}_{k-1,v}\) is given by

$$\begin{aligned} \begin{aligned} W({\mathbf {c}}_{(u_0,u_1,\ldots ,u_{k-2},v)})&=\#\{0\le t\le p^{m}-2: c_{t}\ne 0\}\\&=p^{m}-1-\frac{1}{p}\sum _{t=0}^{p^{m}-2}\sum _{y \in {\mathbb {F}}_{p}}\zeta _{p}^{yc_t} \\&=p^{m}-1-\frac{1}{p}\sum _{t=0}^{p^{m}-2}\sum _{y \in {\mathbb {F}}_{p}}\zeta _{p}^{yTr\left( \left( \sum _{j=0}^{k-2}u_j\pi ^{(p^{jd}+1)t}\right) +v\pi ^{\left( p^{(k-1)d}+1\right) t}\right) } \\&=p^{m}-1-\frac{1}{p}\sum _{y \in {\mathbb {F}}_{p}}\sum _{x \in {\mathbb {F}}^*_{p^m}}\zeta _{p}^{yTr\left( \left( \sum _{j=0}^{k-2}u_jx^{p^{jd}+1}\right) +vx^{p^{(k-1)d}+1}\right) } \\ \end{aligned} \end{aligned}$$

Since \(\frac{m}{gcd(m,k-1)}\) is odd, \(\hbox {gcd}(p^{(k-1)d}+1,p^m-1)=2\). Let \(\gamma \) be an element in \({\mathbb {F}}^*_{p^m}\), when \(\gamma \) traverses \({\mathbb {F}}^*_{p^m}, \gamma ^{p^{(k-1)d}+1}\) traverses all square elements in \({\mathbb {F}}^*_{p^m}\). We conclude that there exist \(\gamma \in {\mathbb {F}}^*_{p^m} \) and \(\mu \in {\mathbb {F}}^*_{p}\) such that \(v=\mu \gamma ^{p^{(k-1)d}+1}\). Then we have

$$\begin{aligned} \begin{aligned}&W({\mathbf {c}}_{(u_0,u_1,\ldots ,u_{k-2},v)})\\&=p^{m}-1-\frac{1}{p}\sum _{y \in {\mathbb {F}}_{p}}\sum _{x \in {\mathbb {F}}^*_{p^m}}\zeta _{p}^{yTr\left( \left( \sum _{j=0}^{k-2}u_jx^{p^{jd}+1}\right) +\mu (\gamma x)^{p^{(k-1)d}+1}\right) }\\&=p^{m}-1-\frac{1}{p}\sum _{y \in {\mathbb {F}}_{p}}\sum _{x \in {\mathbb {F}}^*_{p^m}}\zeta _{p}^{\mu yTr\left( \left( \sum _{j=0}^{k-2}{\mu }^{-1}u_j{\gamma }^{-(p^{jd}+1)}{(\gamma x)}^{p^{jd}+1}\right) +{(\gamma x)}^{p^{(k-1)d}+1}\right) }\\&=p^{m}-1-\frac{1}{p}\sum _{y \in {\mathbb {F}}_{p}}\sum _{x \in {\mathbb {F}}^*_{p^m}}\zeta _{p}^{yTr\left( \left( \sum _{j=0}^{k-2}\mu ^{-1}u_j{\gamma }^{-(p^{jd}+1)}{ x}^{p^{jd}+1}\right) +{x}^{p^{(k-1)d}+1}\right) }\\&=W\left( {\mathbf {c}}_{(\mu ^{-1}u_0\gamma ^{-2},\mu ^{-1}u_1{\gamma }^{-(p^{d}+1)},\ldots ,\mu ^{-1}u_{k-2}{\gamma }^{-(p^{(k-2)d}+1)},1)}\right) .\\ \end{aligned} \end{aligned}$$

Notice that the map \({\mathcal {C}}_{k-1,v} \rightarrow {\mathcal {C}}_{k-1,1}\),

$$\begin{aligned} {\mathbf {c}}_{(u_0,u_1,\ldots ,u_{k-2},v)} \mapsto {\mathbf {c}}_{\left( \mu ^{-1}u_0\gamma ^{-2},\mu ^{-1}u_1{\gamma }^{-(p^{d}+1)},\ldots ,\mu ^{-1}u_{k-2}{\gamma }^{-(p^{(k-2)d}+1)},1\right) } \end{aligned}$$

is bijective, so we assert that the weight distributions of \({\mathcal {C}}_{k-1,v}\) and \({\mathcal {C}}_{k-1,1}\) are the same, which implies \(\alpha _{k-1,v}(z)=\alpha _{k-1,1}(z)\) for any \(v \in {\mathbb {F}}^*_{p^m}\). Lemma 4.1 now is proved. \(\square \)

From the above lemma, one immediately deduces the following.

Lemma 4.2

We have,

$$\begin{aligned} \alpha _{k-1,v}(z)= {\left\{ \begin{array}{ll} \alpha _{k-1}(z), &{}\ v=0,\\ \frac{1}{p^m-1}(\alpha _k(z)-\alpha _{k-1}(z)), &{}\ v \in {\mathbb {F}}^*_{p^m}. \end{array}\right. } \end{aligned}$$

Now we prove Theorem 1.2. Obviously, \({\mathcal {C}}_{m,d,2k-1}\) has length \(p^{m}-1\) and dimension \((2k-1)m\). Moreover, it can be expressed as

$$\begin{aligned} {\mathcal {C}}_{m,d,2k-1}=\Big \{{\mathbf {c}}_{(a_0,\ldots ,a_{k-1},b_0,\ldots ,b_{k-2})}: a_{0},a_{1},\ldots , a_{k-1},b_{0},b_{1},\ldots , b_{k-2} \in {\mathbb {F}}_{p^{m}}\Big \}, \end{aligned}$$

where

$$\begin{aligned} {\mathbf {c}}_{(a_0,\ldots ,a_{k-1},b_0,\ldots ,b_{k-2})}=\left( Tr\left( \sum _{j=0}^{k-1}a_j\pi ^{t(p^{jd}+1)/2}+\sum _{j=0}^{k-2}b_j\left( -\pi ^{(p^{jd}+1)/2}\right) ^t\right) \right) _{t=0}^{p^{m}-2}. \end{aligned}$$

The weight of the codeword \({\mathbf {c}}_{(a_0,\ldots ,a_{k-1},b_0,\ldots ,b_{k-2})}=(c_{0}, c_{1},\ldots , c_{p^{m}-2})\) in \({\mathcal {C}}_{m,d,2k-1}\) is given by

$$\begin{aligned} \begin{aligned}&W({\mathbf {c}}_{(a_0,\ldots ,a_{k-1},b_0,\ldots ,b_{k-2})})\\&= \#\{0\le t\le p^{m}-2: c_{t}\ne 0\}\\&= \#\left\{ 0\le t\le p^{m}-2, t\ even: Tr\left( a_{k-1}(\pi ^t)^{(p^{(k-1)d}+1)/2}+\sum _{j=0}^{k-2}(a_j+b_j)(\pi ^t)^{(p^{jd}+1)/2}\right) \ne 0\right\} \\&\quad +\#\left\{ 0\le t\le p^{m}-2, t\ odd: Tr\left( a_{k-1}(\pi ^t)^{(p^{(k-1)d}+1)/2}+\sum _{j=0}^{k-2}(a_j-b_j)(\pi ^t)^{(p^{jd}+1)/2}\right) \ne 0\right\} \\&=\frac{1}{2}\left( \#\left\{ t: Tr\left( a_{k-1}(\pi ^t)^{p^{(k-1)d}+1}+\sum _{j=0}^{k-2}(a_j+b_j)(\pi ^t)^{p^{jd}+1}\right) \ne 0\right\} \right. \\&\quad \left. +\,\#\left\{ t: Tr\left( \lambda ^{(p^{(k-1)d+1})/2} a_{k-1}(\pi ^t)^{p^{(k-1)d}+1}+\sum _{j=0}^{k-2}(a_j-b_j)\lambda ^{(p^{jd}+1)/2} (\pi ^t)^{p^{jd}+1}\right) \ne 0\right\} \right) \\&=\frac{1}{2}\left( W\left( {\mathbf {c}}_{(a_0+b_0,\ldots ,a_{k-2}+b_{k-2},a_{k-1})}\right) \right. \\&\quad \left. +W\left( {\mathbf {c}}_{((a_0-b_0)\lambda ,\ldots ,(a_{k-2}-b_{k-2})\lambda ^{(p^{(k-2)d}+1)/2},a_{k-1}\lambda ^{(p^{(k-1)d+1})/2})}\right) \right) .\\ \end{aligned} \end{aligned}$$

\({\mathbf {c}}_{(a_0+b_0,\ldots ,a_{k-2}+b_{k-2},a_{k-1})}\) and \({\mathbf {c}}_{((a_0-b_0)\lambda ,\ldots ,(a_{k-2}-b_{k-2})\lambda ^{(p^{(k-2)d}+1)/2},a_{k-1}\lambda ^{(p^{(k-1)d+1})/2})}\) are codewords in \({\mathcal {C}}_{k-1,a_{k-1}}\) and \({\mathcal {C}}_{k-1,a_{k-1}\lambda ^{(p^{(k-1)d+1})/2}}\), respectively. By an argument similar to the proof of Theorem 1.1, the weight enumerator of \({\mathcal {C}}_{m,d,2k-1}\) is given by

$$\begin{aligned} \sum _{a_{k-1}\in {\mathbb {F}}_{p^m}}\alpha _{k-1,a_{k-1}}\left( z^\frac{1}{2}\right) \alpha _{k-1,a_{k-1}\lambda ^{(p^{(k-1)d+1})/2}}\left( z^\frac{1}{2}\right) . \end{aligned}$$

By Lemma 4.2, Theorem 1.2 now follows.

5 Concluding remarks

In this paper, the weight enumerator of cyclic code \({\mathcal {C}}_{m,d,2k}\) is completely determined when \((m,d)=1\). The weight enumerator of cyclic code \({\mathcal {C}}_{m,d,2k-1}\) is also determined under the condition \((m,d)=1\) and \(2\not \mid \frac{m}{gcd(m,k-1)}\). Moreover, when \((m,d)=e\), the weight enumerator of \({\mathcal {C}}_{m,d,2k}\) and \({\mathcal {C}}_{m,d,2k-1}\) are also determined as following. Since the proof is similar to that of Theorems 1.1 or 1.2, we omit the details.

Theorem 5.1

Let m and d be positive integers such that \((m,d)=e\). Let k be a positive integer satisfying \(2 \le k\le \frac{m+e}{2e}\). Then \({\mathcal {C}}_{m,d,2k}\) is a cyclic code over \({\mathbb {F}}_{p}\) with parameters \([p^{m}-1, \frac{2km}{e}, \frac{1}{2}(p^e-1)(p^{m-e}-p^{e([\frac{m}{2e}]-2+k)})]\). Furthermore, the weight enumerator of \({\mathcal {C}}_{m,d,2k}\) is \((\beta _k(z^{\frac{1}{2}}))^2\), where \(\beta _k(z)\) is the weight enumerator of \(\widetilde{{\mathcal {C}}}_{m,d,k}\), which can be deduced from [19].

Theorem 5.2

Let m and d be positive integers such that \((m,d)=e\) and \(2\not \mid \frac{\frac{m}{e}}{gcd(\frac{m}{e},k-1)}\), where k is a positive integer satisfying \(2 \le k\le \frac{m+e}{2e}\). Then \({\mathcal {C}}_{m,d,3}\) is a cyclic code over \({\mathbb {F}}_{p^e}\) with parameters \([p^{m}-1, \frac{3m}{e}, \frac{1}{2}(p^e-1)p^{m-e}]\) and \({\mathcal {C}}_{m,d,2k-1}\) is a cyclic code over \({\mathbb {F}}_{p^e}\) with parameters \([p^{m}-1, \frac{(2k-1)m}{e}, \frac{1}{2}(p^e-1)(p^{m-e}-p^{e([\frac{m}{2e}]-3+k)})]\) when \(3 \le k\le \frac{m+e}{2e}\). Furthermore, the weight enumerator of \({\mathcal {C}}_{m,d,2k-1}\) is

$$\begin{aligned} \left( \beta _{k-1}\left( z^\frac{1}{2}\right) \right) ^2+\frac{1}{p^m-1}{\left( \beta _{k}\left( z^\frac{1}{2}\right) -\beta _{k-1}\left( z^\frac{1}{2}\right) \right) }^2, \end{aligned}$$

where \(\beta _k(z)\) is the weight enumerator of \(\widetilde{{\mathcal {C}}}_{m,d,k}\), which can be deduced from [19].