1 Introduction

As a powerful tool to protect quantum information from decoherence and quantum noise, quantum error-correcting (QEC) codes have been used for a long time. Nowadays, it was shown that QEC codes can be derived from some linear codes satisfying certain dual-containing conditions [3, 32, 33]. However, many classical linear codes with good performance are usually not dual-containing, and they thus cannot be used to produce QEC codes. A natural problem is to construct QEC codes or generalized QEC codes from arbitrary linear codes. In 2006, Brun \( et~al.\) [2] proved that nondual-containing quaternary linear codes can be applied to construct so-called entanglement-assisted quantum error-correcting (EAQEC) codes with the help of preshared entanglement, which contains QEC codes as a special subclass. Generally, we use \([[n, k, d; c]]_q\) to denote a q-ary EAQEC code that encodes k information qubits into n channel qubits with the help of c pairs of maximally entangled states and can correct up to \(\lfloor \frac{d-1}{2}\rfloor \) qubit errors, where d is the minimum distance of this EAQEC code.

After that, many interesting methods and EAQEC codes were proposed and constructed in [4, 10,11,12, 19,20,21, 27, 30, 34, 37]. Moreover, it should be noted that the key to these methods and constructions is to determine the number of necessary entangled states. One effective way is to decompose the defining set of a linear code, which can transmit the original computational task into determining a subset of the defining set of the underlying codes. The whole process of development of this approach can be summarized as follows. First, by decomposing the defining set of primitive quaternary BCH codes, L\(\ddot{\text {u}}\) \( et~al.\) [22] constructed some EAQEC codes with good parameters. Subsequently, Chen \( et~al.\) [5] and Chen \( et~al.\) [6] generalized this method to negacyclic codes and constacyclic codes, respectively. As a result, many EAQEC codes with good parameters have been constructed in this way in the literature (see, for example, [14, 18, 23,24,25,26, 36]).

However, one can find that more entangled states need to be employed as the minimum distances of the EAQEC codes increase. Thus, there are always trade-offs among the parameters of an EAQEC code, one of which is the so-called entanglement-assisted quantum Singleton bound (see Lemma 1 in this paper). An \([[n,k,d; c]]_q\) EAQEC code that achieves this bound with equality is called an entanglement-assisted quantum maximum-distance-separable (EAQMDS) code, which has the largest error-correcting ability for fixed n, k, and c. Therefore, there is always a major enthusiasm for constructing new EAQMDS codes. Let us note that much progress has been made on this topic. In [31], Qian et al. constructed some EAQMDS codes of length \(n=q^2+1\). Later, Wang \( et~al.\) [35] further employed constacyclic codes (including cyclic codes) to obtain several classes of EAQMDS codes with more general parameters of length \(n=q^2+1\); this achievement, contains almost all the known results about EAQMDS codes of the same length. In [38], Zhu et al. constructed new EAQMDS codes of length \(n=\frac{q^2+1}{5}\). In [7], Chen et al. obtained new EAQMDS codes of lengths \(n=\frac{q^2+1}{a}\), \(n=q^2+1\), and \(n=\frac{q^2+1}{2}\) from cyclic codes, where \(a=m^2+1\) (\(m\ge 1\) is odd) and q is odd satisfying \(a\mid (q+m)\) or \(a\mid (q-m)\). Very recently, Pang \( et~al.\) [29] also derived some new EAQMDS codes of lengths \(n=q^2+1\) and \(n=\frac{q^2+1}{2}\) from negacyclic codes and constacyclic codes.

Summarizing the above results, we see easily that the lengths of the known EAQMDS codes are a divisor of \(q^2+1\). Enlightened by these works, we construct four families of EAQEC codes of length \(n=\frac{2(q^2+1)}{a}\) from negacyclic codes, where q is odd, \(a=m^2+1\) and m is an odd integer. For ease of reference, we list them in Table 1. As a result, many EAQMDS codes with minimum distance \(d\le \frac{n+2}{2}\) can be immediately deduced and we present some specific examples in Table 2.

Table 1 The parameters of EAQEC codes of length \(n=\frac{2(q^2+1)}{a}\)

This paper is organized as follows. In Sect. 2, we review some basic results about negacyclic codes. Section 3 contains some basic notation on EAQEC codes. In Sect. 4, we construct four families of new EAQEC codes and EAQMDS codes from negacyclic codes with a unified form. Finally, Sect. 5 concludes the paper.

2 Review of negacyclic codes

In this section, we review some basic concepts and relevant results about negacyclic codes. Throughout this paper, let \({\mathbb {F}}_{q^{2}}\) be the finite field with \(q^{2}\) elements and \({\mathbb {F}}_{q^{2}}^{n}\) be the n-dimensional row vector space over \({\mathbb {F}}_{q^{2}}\), where q is the power of a prime p and n is a positive integer. An \([n,k,d]_{q^2}\) linear code \({\mathcal {C}}\) is a k-dimensional linear subspace of \({\mathbb {F}}_{q^{2}}^{n}\) given by the minimum distance d. A \(q^2\)-ary linear code \({\mathcal {C}}\) of length n is negacyclic if \({\mathcal {C}}\) is invariant under the permutation of \({\mathbb {F}}_{q^{2}}^{n}\)

$$\begin{aligned} (c_0,c_1,\ldots ,c_{n-1})\rightarrow (-c_{n-1},c_0,\ldots ,c_{n-2}). \end{aligned}$$

One can identify any codeword \({\textbf {c}}=(c_0,c_1,\ldots ,c_{n-1})\in {\mathcal {C}}\) with its polynomial representation \(c(x)=c_0+c_1x+\cdots +c_{n-1}x^{n-1}\in {\mathbb {F}}_{q^{2}}[x]/\langle x^{n}+1\rangle \); thus, \({\mathcal {C}}\) is a \(q^2\)-ary negacyclic code of length n if and only if \({\mathcal {C}}\) is an ideal of the quotient ring \({\mathbb {F}}_{q^{2}}[x]/\langle x^{n}+1\rangle \). Since each ideal of \({\mathbb {F}}_{q^{2}}[x]/\langle x^{n}+1\rangle \) is principal, it implies that every negacyclic code \({\mathcal {C}}\) can be generated by a monic divisor g(x) of \(x^{n}+1\). If there is a monic polynomial g(x) with the minimal degree k that can generate a negacyclic code \({\mathcal {C}}\), then g(x) is unique, and we call it the generator polynomial of \({\mathcal {C}}\). In this sense, we further denote \({\mathcal {C}}=\langle g(x) \rangle \) and note that the dimension of \({\mathcal {C}}\) is \(n-k\).

For any element \(a\in {\mathbb {F}}_{q^{2}}\), we denote the conjugate of a by \({\overline{a}}=a^q\). Let \({\textbf{x}}=(x_0,x_1,\ldots ,x_{n-1})\) and \({\textbf{y}}=(y_0,y_1,\ldots ,y_{n-1})\) be any two vectors in \({\mathbb {F}}_{q^{2}}^{n}\). The Hermitian inner product between \({\textbf{x}}\) and \({\textbf{y}}\) is defined by

$$\begin{aligned} \langle {\textbf{x}},{\textbf{y}}\rangle _h=x_0{\overline{y}}_0+x_1 {\overline{y}}_1+\cdots +x_{n-1}{\overline{y}}_{n-1}.\end{aligned}$$

The vectors \({\textbf{x}}\) and \({\textbf{y}}\) are called orthogonal with respect to the Hermitian inner product if \(\langle {\textbf{x}},{\textbf{y}}\rangle _h=0\). The Hermitian dual code of any linear code \({\mathcal {C}}\) is given by

$$\begin{aligned}{\mathcal {C}}^{\bot _{h}}=\{{\textbf{y}}\in {\mathbb {F}}_{q^{2}}^{n}~| ~\langle {\textbf{x}},{\textbf{y}}\rangle _h=0 ~\mathrm{for~ all}~{\textbf{x}}\in {\mathcal {C}}\}.\end{aligned}$$

A linear code \({\mathcal {C}}\) is called Hermitian self-orthogonal if \({\mathcal {C}}\subseteq {\mathcal {C}}^{\bot _{h}}\), and it is called Hermitian self-dual if \({\mathcal {C}}={\mathcal {C}}^{\bot _{h}}\).

From now on, we always assume that n is coprime to q (i.e., \(\textrm{gcd}(n,q)=1\)), which guarantees that \(x^{n}+1\) has no repeated root over \({\mathbb {F}}_{q^{2}}\). Let \(\beta \) be a primitive 2n-th root of unity in \({\mathbb {F}}_{q^{2m}}\), where m is the multiplicative order of \({q^2}\) modulo 2n. Then it is easily seen that \(\gamma =\beta ^2\) is a primitive n-th root of unity. Furthermore, all roots of \(x^{n}+1\) are \(\beta \gamma ^j=\beta ^{1+2j}\) for \(0\le j \le n-1\). Let \({\mathbb {Z}}_{2n}=\{0,1,\cdots ,2n-1\}\) and \(\varOmega _{2n}\) be the set of all odd integers from 1 to 2n. For any \(i\in {\mathbb {Z}}_{2n}\), let \(C_i\) be the \(q^2\)-cyclotomic coset modulo 2n containing i, that is,

$$\begin{aligned}C_i=\{i,iq^2,iq^4,\ldots ,iq^{2(l_i-1)}\},\end{aligned}$$

where \(l_i\) is the smallest positive integer such that \(iq^{2l_i}\equiv i \mod 2n\). Then, the minimal polynomial \(M_i(x)\) of \(\beta ^i\) over \({\mathbb {F}}_{q^2}\) can be expressed as \(M_i(x)=\Pi _{t\in C_i}(x-\beta ^t)\). For a negacyclic code \({\mathcal {C}}=\langle g(x)\rangle \) of length n over \({\mathbb {F}}_{q^2}\), the set \(Z=\{i\in \varOmega _{2n}~|~g(\beta ^i)=0\}\) is said to be the defining set of \({\mathcal {C}}\). It is not difficult to verify that the defining set Z must be a union of some \(q^2\)-cyclotomic cosets modulo 2n and dim\(({\mathcal {C}})=n-|Z|\), where |Z| denotes the cardinality of the set Z.

Finally, we end this section with two well-known bounds for arbitrary linear codes and negacyclic codes, namely, the Singleton bound and the BCH bound for negacyclic codes.

Theorem 1

[28] (Singleton bound) Let \({\mathcal {C}}\) be an \([n,k,d]_{q^2}\) linear code. Then

$$\begin{aligned} n-k\ge d-1. \end{aligned}$$

Moreover, if \(n-k=d-1\), then we call \({\mathcal {C}}\) a maximum-distance-separable (MDS) code.

From the property of pseudocyclic codes in [17], we obtain the following BCH bound of negacyclic codes.

Theorem 2

[17] (BCH bound for negacyclic codes) We assume that n and q are coprime. Let \({\mathcal {C}}\) be a \(q^2\)-ary negacyclic code and its generator polynomial be g(x). Let \(\beta \) be a primitive 2n-th root of unity and b be an integer. If g(x) have the elements \(\{\beta ^{1+2j}~|~b\le j\le b+\delta -2\}\) as roots, then the minimum distance of \({\mathcal {C}}\) is at least \(\delta \).

3 Review of EAQEC codes

Let q be a prime power. A q-ary QEC code Q of length n and size K is a K-dimensional subspace of a \(q^n\)-dimensional Hilbert space \({\mathbb {H}}\)=\({\mathbb {C}}^{q^n}\)=\({\mathbb {C}}^{q}\) \(\otimes \)...\(\otimes {\mathbb {C}}^{q}\) (see [1, 3, 16]). Let us recall that an \([[n, k, d; c]]_q\) EAQEC code \({\mathcal {Q}}\) can encode k information qubits into n channel qubits with the help of c pairs of maximally entangled states and can correct up to \(\lfloor \frac{d-1}{2}\rfloor \) qubits errors, where d is the minimum distance of \({\mathcal {Q}}\). Huber and Grassl [13] proved that the parameters of an EAQEC code obey the following entanglement-assisted quantum Singleton bound. Grassl et al. [8] gave a proof of this bound for arbitrary q.

Lemma 1

[8, 13] (Entanglement-assisted quantum Singleton Bound) Let \({\mathcal {Q}}\) be an \([[n,k,d;c]]_q\) EAQEC code. Then, the following holds:

$$\begin{aligned}&k\le c+\textrm{max}\{0, n-2d+2\}, \end{aligned}$$
(1)
$$\begin{aligned}&k\le n-d+1, \end{aligned}$$
(2)
$$\begin{aligned}&k\le \frac{(n-d+1)(c+2d-2-n)}{3d-3-n},\ \textrm{if}\ 2d\ge n+2 . \end{aligned}$$
(3)

An EAQMDS code is referred to as an EAQEC code satisfying Equation (1) or Equation (3) with equality, where \(2d\le n+2\) or \(2d\ge n+2\), respectively.

As we mentioned before, the key in the construction of EAQEC codes is to determine the number of maximally entangled states, and a possible way is to decompose the defining set of a negacyclic code as follows.

Theorem 3

[14] Let \({\mathcal {C}}\) be a \(q^2\)-ary negacyclic code of length n with a defining set Z. Suppose that \(Z = Z_{1} \cup Z_{2}\) is a decomposition of Z, where \(Z_{1} = Z \cap (-qZ)\), \(Z_{2} = Z\backslash Z_{1}\) and \(-qZ = \{2n - qx~|~x \in Z\}\). If \({\mathcal {C}}\) has parameters \([n, n-|Z|, d]_{q^2}\), then there exists an EAQEC code with parameters \([[n, n-2|Z|+|Z_{1}|, d; |Z_{1}|]]_q\).

4 Construction of EAQMDS codes with new parameters

The main topic of this section is to give constructions of EAQEC codes with a unified form via classical negacyclic codes. Consequently, a family of new EAQMDS codes of length \(n=\frac{2(q^2+1)}{a}\) with general parameters are presented, where q is an odd prime power, \(a=m^2+1\) and m is an odd integer.

Lemma 2

 Let \(n=\frac{2(q^2+1)}{a}\) and \(s=\frac{n}{2}\), where q is an odd prime power, \(a=m^2+1\), m is an odd integer, n is even and \(s=n/2\) is odd. Then, the \(q^2\)-cyclotomic cosets modulo 2n are \(C_s=\{s\}\), \(C_{3s}=\{3s\}\) and \(C_{s-2l}=\{s-2l,s+2l\}\) for \(1\le l\le s-1\).

Let us note that Lemma 2 is a parallel promotion of Lemma 4.1 in [15], so we omit its proof here for simplification.

We note that if \(n=\frac{2(q^2+1)}{a}\), where q is an odd prime power, \(a=m^2+1\) and \(2\mid a\), it implies that \(q\equiv \pm m \) mod a and m is an odd integer. Next, we discuss all cases according to the various values of q and m.

Case I \(q=a\xi -m\)

The following theorem can be used to determine the number of c of an EAQEC code derived from a \(q^2\)-ary negacyclic code, where \(q=a\xi -m\).

Theorem 4

Let \(n=\frac{2(q^2+1)}{a}\) and \(s=\frac{n}{2}\), where \(q=a\xi -m\) is an odd prime power, \(a=m^2+1\) and m is an odd integer. For a nonnegative integer \(\alpha \) with \(0\le \alpha \le \xi \), we suppose that \({\mathcal {C}}\) is a negacyclic code with a defining set Z given by

$$\begin{aligned} Z=C_s\cup C_{s+2}\cup \dots \cup C_{s+2[\alpha q+(a-m)\xi +a-2m]}. \end{aligned}$$

Let us define \(Z_1=Z\cap (-qZ)\). Then the following statements hold.

(1) If \(m\equiv 1~\textrm{mod}~4\) and \(\xi \) is an odd positive integer or \(m\equiv 3~\textrm{mod}~4\) and \(\xi \) is an even positive integer, then \(|Z_{1}|=2\alpha [a\alpha +2(a-m)]+2a-4m+1;\)

(2) If \(m\equiv 1~\textrm{mod}~4\) and \(\xi \) is an even positive integer or \(m\equiv 3~\textrm{mod}~4\) and \(\xi \) is an odd positive integer, then \(|Z_{1}|=2\alpha [a\alpha +2(a-m)]+2a-4m.\)

Proof

For brevity, we show the case where \(m\equiv 1~\textrm{mod}~4\) and \(\xi \) is an odd positive integer of (1), and the other cases are similar. Since

$$\begin{aligned} Z=C_s\cup C_{s+2}\cup \dots \cup C_{s+2[\alpha q+(a-m)\xi +a-2m]}, \end{aligned}$$

we have

$$\begin{aligned} -qZ=-qC_s\cup -qC_{s+2}\cup \dots \cup -qC_{s+2[\alpha q+(a-m)\xi +a-2m]}. \end{aligned}$$

For each \(-qC_s\), by examining the intersection of Z and \(-qC_s\), we obtain that

$$\begin{aligned} | Z\cap (-qZ)|=2\alpha (a\alpha +2a-2m)+2a-4m+1; \end{aligned}$$

the detailed proof is technical and can be found in arXiv:2305.08517v1.

Keeping the definition of \(Z_{1}\) in Theorem 3, we have

$$\begin{aligned} |Z_{1}|=| Z\cap (-qZ)|=2\alpha (a\alpha +2a-2m)+2a-4m+1. \end{aligned}$$

This completes the proof. \(\square \)

From Theorem 4 above, we obtain the first construction of EAQEC codes in the following theorem.

Theorem 5

Let \(n=\frac{2(q^2+1)}{a}\) and \(s=\frac{n}{2}\), where \(q=a\xi -m\) is an odd prime power, \(a=m^2+1\) and m is an odd integer. Let \(\alpha \) be a nonnegative integer satisfying \(0\le \alpha \le \xi \). Then, the following statements hold.

(1) If \(m\equiv 1~\textrm{mod}~4\) and \(\xi \) is an odd positive integer or \(m\equiv 3~\textrm{mod}~4\) and \(\xi \) is an even positive integer, then there are EAQEC codes with parameters \([[n, k, d; c]]_q\), where

$$\begin{aligned} k=n-4\alpha q+4(a-m)(\alpha -\xi ) +2a\alpha ^2-2a+4m-1,\\ d=2[\alpha q+(a-m)\xi +a-2m +1],\\ c=2\alpha [a\alpha +2(a-m)]+2a-4m+1. \end{aligned}$$

(2) If \(m\equiv 1~\textrm{mod}~4\) and \(\xi \) is an even positive integer or \(m\equiv 3~\textrm{mod}~4\) and \(\xi \) is an odd positive integer, then there are EAQEC codes with parameters \([[n, k, d; c]]_q\), where

$$\begin{aligned} k=n-4\alpha q+4(a-m)(\alpha -\xi ) +2a\alpha ^2-2a+4m-2,\\ d=2[\alpha q+(a-m)\xi +a-2m +1],\\ c=2\alpha [a\alpha +2(a-m)]+2a-4m. \end{aligned}$$

In addition, they are EAQMDS codes if \(d\le \frac{n+2}{2}\).

Proof

For brevity, let us just show the case where \(m\equiv 1~\textrm{mod}~4\) and \(\xi \) is an odd positive integer of case (1) and the other cases are similar. For a nonnegative integer \(\alpha \) with \(0\le \alpha \le \xi \), we suppose that \({\mathcal {C}}\) is a negacyclic code of length n with a defining set

$$\begin{aligned} Z=C_s\cup C_{s+2}\cup \dots \cup C_{s+2[\alpha q+(a-m)\xi +a-2m]}, \end{aligned}$$

where \(\xi \), a, m, q and s are defined as above.

Then, the dimension of \({\mathcal {C}}\) is \(n-2[\alpha q+(a+m)\xi ]+4\,m-2a-1\). We observe that the negacyclic code \({\mathcal {C}}\) has \(2[\alpha q+(a-m)\xi +a-2m]+1\) consecutive roots. Then, it follows from Theorem 2 that the minimum distance of \({\mathcal {C}}\) is at least \(2[\alpha q+(a-m)\xi +a-2m +1]\). Hence, according to Theorem 1, \({\mathcal {C}}\) is an MDS code with parameters \([n,n-2[\alpha q+(a+m)\xi ]+4\,m-2a-1, 2[\alpha q+(a-m)\xi +a-2\,m +1]~]_{q^2}\).

We note from Theorem 4 that \(|Z_{1}|=2\alpha (a\alpha +2a-2\,m)+2a-4\,m+1\). Then Theorem 3 can produce EAQEC codes with parameters \([[n, k, d; c]]_q\), where

$$\begin{aligned} k=n-4\alpha q+4(a-m)(\alpha -\xi ) +2a\alpha ^2-2a+4m-1,\\ d=2[\alpha q+(a-m)\xi +a-2m +1],\\ c=2\alpha [a\alpha +2(a-m)]+2a-4m+1. \end{aligned}$$

Moreover, it can be checked that

$$\begin{aligned} n+c-k=4[\alpha q+(a-m)\xi +a-2m +1]-2=2(d-1). \end{aligned}$$

Therefore, it implies that the EAQEC codes are EAQMDS codes if \(d\le \frac{n+2}{2}\) by Lemma 1. \(\square \)

Case II\(~~~~q=a\xi +m\)

As for the case that \(n=\frac{2(q^2+1)}{a}\) and \(q=a\xi +m\), where \(a=m^2+1\) and m is an odd integer, we can also obtain new EAQEC codes. The proof is similar to that in Case I, so we omit it here.

Theorem 6

Let \(n=\frac{2(q^2+1)}{a}\) and \(s=\frac{n}{2}\), where \(q=a\xi +m\) is an odd prime power, \(a=m^2+1\) and m is an odd integer. For a nonnegative integer \(\alpha \) with \(0\le \alpha \le \xi \), we suppose that \({\mathcal {C}}\) is a negacyclic code with a defining set Z given as follows

$$\begin{aligned} Z=C_s\cup C_{s+2}\cup \dots \cup C_{s+2[\alpha q+m\xi ]}. \end{aligned}$$

Let us define \(Z_1=Z\cap (-qZ)\). Then the following statements hold.

(1) If \(m\equiv 1~\textrm{mod}~4\) and \(\xi \) is an odd positive integer or \(m\equiv 3~\textrm{mod}~4\) and \(\xi \) is an even positive integer, then \(|Z_{1}|=2\alpha (a\alpha +2m)+1;\)

(2) If \(m\equiv 1~\textrm{mod}~4\) and \(\xi \) is an even positive integer or \(m\equiv 3~\textrm{mod}~4\) and \(\xi \) is an odd positive integer, then \(|Z_{1}|=2\alpha (a\alpha +2m).\)

Proof

For brevity, we show the case \(m\equiv 1~\textrm{mod}~4\) and \(\xi \) is an odd positive integer of case (1) and the other cases are similar. Since

$$\begin{aligned} Z=C_s\cup C_{s+2}\cup \dots \cup C_{s+2[\alpha q+m\xi ]}. \end{aligned}$$

We have

$$\begin{aligned} -qZ=-qC_s\cup -qC_{s+2}\cup \dots \cup -qC_{s+2[\alpha q+m\xi ]}. \end{aligned}$$

For each \(-qC_s\), by examining the intersection of Z and \(-qC_s\), we obtain that

$$\begin{aligned} | Z\cap (-qZ)|=2\alpha (a\alpha +2m)+1; \end{aligned}$$

the detailed proof is technical and can be found in arXiv:2305.08517v1.

Keeping the definition of \(Z_{1}\) in Theorem 3, we have

$$\begin{aligned} |Z_{1}|=| Z\cap (-qZ)|=2\alpha (a\alpha +2m)+1. \end{aligned}$$

This completes the proof.

\(\square \)

From Theorem 6 above, we obtain the second construction of EAQEC codes in the following theorem.

Theorem 7

Let \(n=\frac{2(q^2+1)}{a}\) and \(s=\frac{n}{2}\), where \(q=a\xi +m\) is an odd prime power, \(a=m^2+1\) and m is an odd integer. Let \(\alpha \) be a nonnegative integer satisfying \(0\le \alpha \le \xi \). Then, the following statements hold.

(1) If \(m\equiv 1~\textrm{mod}~4\) and \(\xi \) is an odd positive integer or \(m\equiv 3~\textrm{mod}~4\) and \(\xi \) is an even positive integer, then there are EAQEC codes with parameters \([[n, k, d; c]]_q\), where

$$\begin{aligned} k= n-4\alpha q+4m(\alpha -\xi )+2a\alpha ^2-1,\\ d=2(\alpha q+m\xi +1),\\ c=2\alpha (a\alpha +2m)+1. \end{aligned}$$

(2) If \(m\equiv 1~\textrm{mod}~4\) and \(\xi \) is an even positive integer or \(m\equiv 3~\textrm{mod}~4\) and \(\xi \) is an odd positive integer, then there are EAQEC codes with parameters \([[n, k, d; c]]_q\), where

$$\begin{aligned} k=n-4\alpha q+4m(\alpha -\xi )+2a\alpha ^2-2,\\ d=2(\alpha q+m\xi +1),\\ c=2\alpha (a\alpha +2m). \end{aligned}$$

In addition, they are EAQMDS codes if \(d\le \frac{n+2}{2}\).

Proof

For brevity, let us just show the case where \(m\equiv 1~\textrm{mod}~4\) and \(\xi \) is an odd positive integer of case (1) and the other cases are similar. For a nonnegative integer \(\alpha \) with \(0\le \alpha \le \xi \), we suppose that \({\mathcal {C}}\) is a negacyclic code of length n with a defining set

$$\begin{aligned} Z=C_s\cup C_{s+2}\cup \dots \cup C_{s+2[\alpha q+m\xi ]}, \end{aligned}$$

where \(\xi \), a, m, q and s are defined as above.

Then, the dimension of \({\mathcal {C}}\) is \(n-2(\alpha q+m\xi )-1\). We observe that the negacyclic code \({\mathcal {C}}\) has \(2(\alpha q+m\xi )+1\) consecutive roots. Then, it follows from Theorem 2 that the minimum distance of \({\mathcal {C}}\) is at least \(2(\alpha q+m\xi +1)\). Hence, according to Theorem 1, \({\mathcal {C}}\) is an MDS code with parameters \([n,n-2(\alpha q+m\xi )-1, 2(\alpha q+m\xi +1)]_{q^2}\).

We note from Theorem 6 that \(|Z_{1}|=2\alpha (a\alpha +2\,m)+1\). Then Theorem 3 can produce EAQEC codes with parameters \([[n, k, d; c]]_q\), where

$$\begin{aligned} k=n-4\alpha q+4m(\alpha -\xi )+2a\alpha ^2-1,\\ d=2(\alpha q+m\xi +1),\\ c=2\alpha (a\alpha +2m)+1. \end{aligned}$$

Moreover, it can be checked that

$$\begin{aligned} n+c-k=4(\alpha q+m\xi +1)-2=2(d-1). \end{aligned}$$

Therefore, it implies that the EAQEC codes are EAQMDS codes if \(d\le \frac{n+2}{2}\) by Lemma 1.

\(\square \)

Remark 1

Some EAQEC codes obtained from Theorems 5 and 7 are listed in Table 2.

Table 2 Some EAQEC codes obtained from Theorems 5 and 7

5 Conclusion

In this study, we construct four families of EAQEC codes with a unified length form \(n=\frac{2(q^2+1)}{a}\) derived from negacyclic codes, where q is an odd prime power, a is determined as \(m^2+1\), and m represents an odd integer. Furthermore, our EAQEC codes have larger minimum distances compared to those of the existing codes reported in the literature. This characteristic enhances their capability to detect and correct qubit errors effectively. In particular, new EAQMDS codes can be deduced from these EAQEC codes.