1 Introduction

In 1995, Shor [1] presented the first QEC code [[9, 1, 3]] to reduce decoherence in quantum computation. Afterward, binary or nonbinary stabilizer QEC codes were of particular interest and investigated by many researchers, see Refs. [2,3,4,5,6,7,8,9,10]. Calderbank et al. clarified that binary QEC codes could come from classical codes over \({\mathbb {F}}_2\) or \({\mathbb {F}}_4\) in [2]. Later, in [5], Ketkar et al. made it clear that q-ary QEC codes can be constructed from Hermitian self-orthogonal classical codes over \({\mathbb {F}}_{q^2}\) or from Euclidean self-orthogonal classical codes over \({\mathbb {F}}_{q}\). In the past years, constructing QEC codes, denoted as \([[n, k, d]]_q\), with good parameters has become a central topic in coding field. A QEC code is optimal if its parameters satisfy \(k=n-2d+2\) and called a quantum MDS (QMDS) code. Naturally, many consequences on QMDS codes have been verified in [11,12,13,14,15,16,17,18,19].

It is well known that the self-orthogonality conditions mentioned above prevent many common classical codes from producing QEC codes. To weaken self-orthogonality condition and simplify the theory of QEC codes, Brun et al. [20] presented entanglement-assisted formalism to obtain entanglement-assisted QEC (EAQEC) codes from any classical linear codes. They showed that EAQEC codes, denoted as \([[n, k, d;c]]_q\), are feasible if pre-shared entanglement bits between the encoder and decoder are available. Clearly, an EAQEC code is a standard QEC code if the number of entanglement bits is \(c=0\). Moreover, EAQEC codes are MDS if they achieve the following EA-Singleton bound. Such codes are called entanglement-assisted QMDS (EAQMDS) codes.

Lemma 1

(EA-Singleton Bound, [20,21,22]) For any \([[n, k, d; c]]_q\) EAQEC code, if \(d\le \frac{n+2}{2}\), then it satisfies \(2d\le n-k+c+2\), where \(0\le c\le n-1\).

Recently, many EAQMDS codes have been derived from constacyclic codes or generalized Reed-Solomon (GRS) codes, extended GRS codes, see Refs. [23, 25,26,27,28,29,30]. Fan et al. [23] proposed three classes of EAQMDS codes by utilizing only one entanglement bit. In 2018, Lu et al. [25, 26] constructed classes of EAQMDS codes with some special lengths by consuming one entanglement bit or four entanglement bits. In [28], Li et al. obtained a family of EAQMDS codes of length \(n=\frac{q-1}{2a}(q+1)\) from negacyclic codes and made a general statement of \(c\le 2a\) instead of some specific values. Liu et al. [29] applied constacyclic codes to EAQMDS codes with length \(n=\frac{q+1}{r}(q-1)\) by determining the value of c from 1 to r, where \(3\le r\le 7\). Using more flexible entanglement bits to construct EAQEC codes always means more difficult to verify their parameters. In 2019, Qian et al. [27] derived a family of EAQEC codes with flexible parameters from cyclic codes. Via GRS codes and extended GRS codes, Fang et al. also obtained several families of EAQMDS codes with flexible parameters in [30].

It is fortunate to find that more and more conclusions on EAQEC codes with flexible parameters have been made in recent years although it is hard to determine their required entanglement bits. As shown in the papers mentioned above, the minimum distance of EAQEC codes or EAQMDS codes increased remarkably with the help of pre-shared entanglement bits. However, almost all of them did not use the entanglement resource fully or merely discussed some sparse special lengths under certain conditions. In this paper, we pay attention to constructing EAQEC codes of length \(n=\frac{q-1}{a}(q+1)\) from cyclic codes and negacyclic codes, where \(a\mid (q-1)\) and \(q\ge 2a+1\). By deeply investigating properties of \(q^2\)-cyclotomic cosets modulo rn, where \(r=1\) or \(r=2\), we clarify that the number of entanglement bits can take almost all possible values. That is to say, our construction can produce series of new EAQEC codes with large minimum distance and generalize almost all known results with the same length in [11,12,13,14,15,16,17,18,19, 23, 26, 28,29,30]. In particular, all our codes are EAQMDS codes if their minimum distance \(d\le \frac{n+2}{2}\).

The paper is organized as follows. In Sect. 2, some basic notions and preliminaries are recalled. In Sects. 3 and 4, EAQEC codes of length \(n=\frac{q-1}{a}(q+1)\) are constructed from cyclic codes and negacyclic codes, respectively. In Sect. 5, some remarks and comparisons are made finally.

2 Preliminaries

In this section, we recall some basic concepts on constacyclic codes, cyclotomic cosets and EAQEC codes. For more details, we may refer to Refs. [20, 21, 31, 32].

Let q be a prime power and \({\mathbb {F}}_{q^2}\) be a finite field with \(q^{2}\) elements. For any \(\alpha \in {\mathbb {F}}_{q^2}\), \(\overline{\alpha }=\alpha ^{q}\) is denoted as the conjugation of \(\alpha \). Given two vectors \(\mathbf {x}=(x_{1},x_{2},\ldots ,x_{n})\), \(\mathbf {y}=(y_{1},y_{2},\ldots ,y_{n})\) in \({\mathbb {F}}_{q^{2}}^{n}\), their Hermitian inner product is defined by

$$\begin{aligned} (\mathbf {x},\mathbf {y})_{h}=\sum \limits _{i=1}^n \overline{x_{i}}y_{i} =\overline{x_{1}}y_{1}+\overline{x_{2}}y_{2}+\cdots +\overline{x_{n}}y_{n}. \end{aligned}$$

A linear code \({\mathcal {C}}\) with length n over \({\mathbb {F}}_{q^2}\) is said to be a k-dimension subspace of \({\mathbb {F}}_{q^{2}}^{n}\), which is denoted by \([n, k]_{q^2}\). Hermitian dual code of \({\mathcal {C}}\) is defined as

$$\begin{aligned} {\mathcal {C}}^{\bot _{h}}=\{\mathbf {x}\in {\mathbb {F}}_{q^{2}}^{n} | (\mathbf {x},\mathbf {y})_{h}=0, \hbox {for any}~ \mathbf {y} \in {\mathcal {C}}\}. \end{aligned}$$

For any codeword \((c_{0},c_{1},\ldots ,c_{n-1})\in {\mathcal {C}}\), if \((\lambda c_{n-1},c_{0},c_{1},\ldots ,c_{n-2})\) is still a codeword in \({\mathcal {C}}\), then \({\mathcal {C}}\) is called a \(\lambda \)-constacyclic code, where \(\lambda \in {\mathbb {F}}_{q^2} \backslash \{0\}\). Particularly, if \(\lambda =1\), then \({\mathcal {C}}\) is a cyclic code; if \(\lambda =-1\), then \({\mathcal {C}}\) is a negacyclic code. Denote that \(r=\mathrm{ord}_{q^2}(\lambda )\), then one can get that \({\mathcal {C}}\) is a cyclic code if \(r=1\) and \({\mathcal {C}}\) is a negacyclic code if \(r=2\) by definition.

Define a mapping \(\varphi \) from \({\mathbb {F}}_{q^{2}}^{n}\) to \({\mathcal {R}}_{n}=\frac{{\mathbb {F}}_{q^2}[x]}{\langle x^{n}-\lambda \rangle }\) as follows:

$$\begin{aligned} (c_{0},c_{1},\ldots ,c_{n-1})\mapsto c_{0}+c_{1}x+\cdots +c_{n-1}x^{n-1}. \end{aligned}$$

One can check that \({\mathcal {C}}\) is a \(\lambda \)-constacyclic code with length n over \({\mathbb {F}}_{q^2}\) if and only if \(\varphi ({\mathcal {C}})\) is an ideal of quotient ring \({\mathcal {R}}_{n}\). Thus, there exists a monic polynomial divisor g(x) of \(x^{n}-\lambda \) with the least degree such that g(x) generates \({\mathcal {C}}\), i.e., \({\mathcal {C}}=\langle g(x)\rangle \). It is well known that \({\mathcal {C}}\) has dimension \(k=n-\)deg(g(x)). Let gcd\((q, n)=1\), \(\Omega _{r, n}=\{1+ir\mid 0\le i\le n-1\}\) and \(\zeta \) be a primitive rnth root of unity in some extension field of \({\mathbb {F}}_{q^2}\) such that \(\zeta ^n=\lambda \). For any \(j\in \Omega _{r, n}\), \(q^2\)-cyclotomic coset \(C_{j}\) modulo rn containing j is defined by

$$\begin{aligned} C_{j}=\{{j,jq^{2},j(q^{2})^{2},\ldots ,j(q^{2})^{l-1}}\} \bmod rn, \end{aligned}$$

where l is the smallest positive integer such that \(j(q^{2})^{l}\equiv j\bmod rn\). The defining set of \({\mathcal {C}}\) is the set \(T=\{j\in \Omega _{r, n}|g(\zeta ^j)=0\}\). Obviously, we can see that T is a union of some \(q^2\)-cyclotomic cosets modulo rn and the dimension of \({\mathcal {C}}\) is \(k=n-|T|\).

The following lemma can be used to determine minimum distance of a \(\lambda \)-constacyclic code.

Lemma 2

(The BCH bound for \(\lambda \)-constacyclic codes, [34, 35]) Let \({\mathcal {C}}\) be a \(q^{2}\)-ary \(\lambda \)-constacyclic code of length n with generator polynomial g(x). If g(x) has its elements \(\{\zeta ^{1+ir}|0\le i \le \delta -2\}\) as roots, where \(\zeta \) is a primitive rnth root of unity, then the minimum distance of \({\mathcal {C}}\) is at least \(\delta \).

As to compute the parameters of EAQEC codes constructed from a linear code \({\mathcal {C}}\), we need to determine the optimal number of required entanglement bits c. Wilde et al. [21] provided a formula that \(c=rank(HH^\dag )\), where H is a parity check matrix of \({\mathcal {C}}\) and \(H^\dag \) is conjugate transpose of H. Further, for EAQEC codes obtained from constacyclic codes (including cyclic codes and negacyclic codes), the authors in [24, 29, 33] proposed decomposition of their defining set to count the value of c instead of calculating \(rank(HH^\dag )\) as follows.

Definition 1

Let \({\mathcal {C}}\) be a \(q^2\)-ary \(\lambda \)-constacyclic code of length n with defining set T. Denote \(T_{ss}=T\bigcap -qT\) and \(T_{sas}=T\backslash T_{ss}\), where \(-qT=\{-qx\bmod rn\mid x\in T\}\) and \(r\mid (q+1)\). Then, \(T=T_{ss}\bigcup T_{sas}\) is called decomposition of T.

Using the definition above, parameters of the EAQEC codes constructed from constacyclic codes can be confirmed readily.

Theorem 1

([29], Theorem 1) Let \({\mathcal {C}}\) be an \([n, k, d]_{q^2}\)\(\lambda \)-constacyclic code with defining set T. Suppose decomposition of T is \(T=T_{ss}\bigcup T_{sas}\). Then there exists an \([[n, n-2|T|+|T_{ss}|, d; |T_{ss}|]]_q\) EAQEC code.

From now on till the end of this paper, we give some notations beforehand to make the discussions in the sequel simple.

Notation 1

Set \(n=\frac{q-1}{a}(q+1)=a'(q+1)\), where \(q\ge 2a+1\) is a prime power and \(aa'=q-1\). Given a symbol \({\mathcal {S}}\), \(|{\mathcal {S}}|\) is defined as its cardinality if \({\mathcal {S}}\) is a set and its absolute value if \({\mathcal {S}}\) is an integer. Denote the sequence \(\{b,b+1,\ldots ,e\}\) by [be], where \(b<e\). For \(\mu \in [b, e]\), denote that \(\underline{\mu }=[b, e]\).

Throughout this paper, we study EAQEC codes derived from cyclic codes or negacyclic codes with length n, i.e., \(r=1\) or \(r=2\). Note that \(i(q^2-1)\equiv 0\bmod rn\) holds for all \(1\le i\le n-1\). Thus, it is easy to see that any \(q^2\)-cyclotomic coset modulo rn has only one element.

3 Construction of EAQEC codes from cyclic codes with length n

In this section, we investigate the properties of \(q^2\)-cyclotomic cosets modulo n first of all. Then, by decomposition of defining set, the number of entanglement bits can be determined precisely. Consequently, series of EAQEC codes could be obtained from these cyclic codes.

Lemma 3

Let \(n, q, a, a'\) be given as above.

  1. (1)

    For \(i\equiv 0\bmod a'\), any \(C_i\) is a skew symmetric coset.

  2. (2)

    For \(i\in [1, n-1]\), let \(i=ua'+v\), where \(v\in [1, a']\) if \(u\in [0, q-1]\) and \(v\in [1, a'-1]\) if \(u=q\). Then,

    $$\begin{aligned} -qC_{ua'+v}=\left\{ \begin{array}{lllll} C_{(u-1-va)a'+a'-v} &{}\text{ if }\ u-1-va\ge 0;\\ C_{(q+u-va)a'+a'-v} &{}\text{ if }\ u-1-va<0.\\ \end{array}\right. \end{aligned}$$

Proof

  1. (1)

    Assume that there exists a skew symmetric coset \(C_i\), then there holds \(i(q+1)\equiv 0\bmod n\Leftrightarrow i\equiv 0\bmod a'\). Clearly, our desired result has been clarified.

  2. (2)

    Note that any \(q^2\)-cyclotomic coset \(C_i\) contains one element. From \(-q(ua'+v)=-ua'(q+1)+ua'-v(q-1)-v=-ua'(q+1)+(u-1-va)a'+a'-v\), one can see that \(-q(ua'+v)\equiv (u-1-va)a'+a'-v\bmod n\) if \(u-1-va\ge 0\) and \(-q(ua'+v)\equiv (q+u-va)a'+a'-v\bmod n\) if \(u-1-va<0\). Thus, (2) holds.

\(\square \)

Lemma 4

Let \(n, q, a, a'\) be given as above. Denote that \(f\in [1, a'-1]\) if \(e=0\) and \(f\in [\lceil \frac{e}{a}\rceil , a'-1]\) if \(e\in [1, a(a'-1)]\). Set \(T_1=\bigcup C_{ea'+f}\), there holds \(T_1\bigcap -qT_1=\emptyset \).

Proof

From Lemma 3 (2), one needs to verify firstly that if \(e-1-fa<0\) or not. Indeed, \(e-1-fa<0\) holds when \(e=0\). When \(e\in [1, a(a'-1)], f\in [\lceil \frac{e}{a}\rceil , a'-1]\), it is easy to check that \(e-1-fa\le e-\lceil \frac{e}{a}\rceil a-1<0\) as well. Thus, we have that \(-qT_1=\bigcup C_{(q+e-fa)a'+a'-f}\).

Suppose that \(T_1\bigcap -qT_1\ne \emptyset \), from \(T_1=\bigcup C_{ea'+f}\) and the range of ef, there are two cases as below.

Case 1: When \(e=0\), one can see that \(\underline{q+e-fa}\subseteq \underline{e}\backslash \{0\}\) then \(a'-f\ge \lceil \frac{q+e-fa}{a}\rceil =\lceil \frac{q-fa}{a}\rceil >a'-f\), a contradiction.

Case 2: When \(e\in [1, a(a'-1)]\), we also have that \(\underline{q+e-fa}\subseteq \underline{e}\backslash \{0\}\). Note that \(a'-f\ge \lceil \frac{q+e-fa}{a}\rceil >a'-f\), a contradiction.

Till now, our claim holds. \(\square \)

As shown in Theorem 1, one could know the number of entanglement bits by calculating the cardinality of \(T_{ss}\).

Theorem 2

Let \(n, q, a, a'\) be given as above. Keep the notations defined in Lemma 4. If \({\mathcal {C}}\) is a cyclic code with defining set \(T=C_1\bigcup C_2\bigcup \cdots \bigcup C_{\beta a'+a'-1}\), where \(\beta \in [0, q]\), then

$$\begin{aligned} |T_{ss}|=\left\{ \begin{array}{lllll} \beta &{}\text{ for }\ \beta \in [0, a];\\ \beta +\sum \limits _{k=a+1}^{\beta }2\left( \left\lceil \frac{k}{a}\right\rceil -1\right) &{}\text{ for }\ \beta \in [a+1, q-1];\\ n-1 &{}\text{ for }\ \beta =q.\\ \end{array}\right. \end{aligned}$$

Proof

See in “Appendix 1”. \(\square \)

After the detailed analysis on cyclotomic cosets modulo n and defining set of certain cyclic codes of length n, one can construct EAQEC codes from these cyclic codes naturally.

Theorem 3

Let \(n, q, a, a'\) be given as above. Keep the notations defined in Lemma 4 and Theorem 2. There exist EAQEC codes with parameters \([[n, n-2(d-1)+c, d; c]]_q\).

  1. (1)

    If \(q=2a+1\), then

    $$\begin{aligned} \left\{ \begin{array}{ll} d\in [2, a'], c=0 &{}\text{ for }\ \beta =0;\\ d\in [\beta a'+1, (\beta +1) a'], c=\beta &{}\text{ for }\ \beta \in [1, a];\\ d=n, c=n-1 &{}\text{ for }\ \beta =q.\\ \end{array}\right. \end{aligned}$$
  2. (2)

    If \(q\ge 3a+1\), then

    $$\begin{aligned} \left\{ \begin{array}{ll} d\in [2, a'], c=0 &{}\text{ for }\ \beta =0;\\ d\in [\beta a'+1, (\beta +1) a'], c=\beta &{}\text{ for }\ \beta \in [1, a];\\ d\in [\beta a'+\left\lceil \frac{\beta }{a}\right\rceil , (\beta +1) a'], c=\beta +\sum \limits _{k=a+1}^{\beta }2\left( \left\lceil \frac{k}{a}\right\rceil -1\right) &{}\text{ for }\ \beta \in [a+1, q-a-1];\\ d=n, c=n-1 &{}\text{ for }\ \beta =q.\\ \end{array}\right. \end{aligned}$$

    Particularly, for \(\beta \in [0, \frac{q-1}{2}]\), these EAQEC codes are EAQMDS codes.

Proof

According to different q, we can calculate the exact parameters of EAQEC codes with length n for given minimum distance.

Note that any \(q^2\)-cyclotomic coset contains only one element. It is clear that the cyclic code \({\mathcal {C}}\) with defining set \(T=C_1\bigcup C_2\bigcup \cdots \bigcup C_{d-1}\) is an MDS code with parameters \([n, n-d+1, d]_{q^2}\). From Theorems 1 and 2, one can obtain series of \([[n, n-2(d-1)+c, d; c]]_q\) EAQEC codes easily.

For \(\beta \in [0, \frac{q-1}{2}]\), there holds \(d\le (\beta +1) a'=\frac{n}{2}\). Then, one can conclude that the constructed EAQEC codes above are EAQMDS codes since all of them saturate the EA-Singleton bound when \(\beta \in [0, \frac{q-1}{2}]\). \(\square \)

Table 1 New EAQEC codes with length \(n=q^2-1\)
Table 2 New EAQEC codes with length \(n=\frac{q-1}{2}(q+1)\)
Table 3 New EAQEC codes with length \(n=\frac{q-1}{3}(q+1)\)
Table 4 New EAQEC codes with length \(n=\frac{q-1}{4}(q+1)\)
Table 5 New EAQEC codes with length \(n=\frac{q-1}{5}(q+1)\)
Table 6 New EAQEC codes with length \(n=\frac{q-1}{6}(q+1)\)

4 Construction of EAQEC codes from negacyclic codes with length n

In this section, the properties of \(q^2\)-cyclotomic cosets modulo 2n are investigated in detail. From these results, many EAQEC codes with length n could be constructed from negacyclic codes. Set \(r=2\), \(r\mid a\) qnd \(aa'=q-1\), then, a is an even positive integer and q is an odd prime power.

Lemma 5

Let \(n, q, a, a'\) be given as above. Denote that \(i\in [0, n-1]\).

  1. (1)

    Any \(C_{1+2i}\) is a skew asymmetric coset.

  2. (2)

    Let \(i=ua'+v\), where \(u\in [0, q], v\in [0, a'-1]\). Then,

    $$\begin{aligned} -qC_{1+2(ua'+v)}=\left\{ \begin{array}{ll} C_{1+2((u-va-\frac{a}{2}-1)a'+a'-1-v)} &{} \text{ if }\ u-va-\frac{a}{2}-1\ge 0;\\ C_{1+2((q+u-va-\frac{a}{2})a'+a'-1-v)} &{} \text{ if }\ u-va-\frac{a}{2}-1<0.\\ \end{array}\right. \end{aligned}$$

Proof

  1. (1)

    Suppose that \(C_{1+2i}\) is skew symmetric, one can derive that \((1+2i)(q+1)\equiv 0\bmod 2n=2a'(q+1)\Leftrightarrow 1+2i\equiv 0\bmod 2a'\). Actually, \(1+2i\) is an odd integer, so this congruence cannot hold. Then, (1) follows.

  2. (2)

    If \(i=ua'+v\), then \(C_{1+2i}=C_{1+2(ua'+v)} =\{1+2(ua'+v)\}\). Thus, from \(-q(1+2(ua'+v))=-q-2(q+1) ua'+2ua'-2qv=-(q-1)-2(q-1)v+2ua'-2(q+1)ua'-1-2v\equiv 1 +2((u-va-\frac{a}{2}-1)a'+a'-1-v)\bmod 2n\), it follows that \(-q(1+2(ua'+v)) \equiv 1+2((u-va-\frac{a}{2}-1)a'+a'-1-v)\bmod 2n\) if \(u-va-\frac{a}{2}-1\ge 0\) and \(-q(1+2(ua'+v))\equiv 1 +2((q+u-va-\frac{a}{2})a'+a'-1-v)\bmod 2n\) if \(u-va -\frac{a}{2}-1<0\). \(\square \)

Lemma 6

Let \(n, q, a, a'\) be given as above. Denote that \(f\in [0, a'-1]\) if \(e\in [0, \frac{a}{2}]\) and \(f\in [\lceil \frac{e-\frac{a}{2}}{a} \rceil , a'-1]\) if \(e\in [\frac{a+2}{2}, q-\frac{a+2}{2}]\). Set \(T_2=\bigcup C_{1+2(ea'+f)}\), there holds \(T_2\bigcap -qT_2=\emptyset \).

Proof

According to the value of e, our discussions are divided into the following two cases.

Case 1: If \(e\in [0, \frac{a}{2}]\) and \(f\in [0, a'-1]\), it is easy to check that \(e-fa-\frac{a}{2}-1<0\). Then, \(-qT_2=\bigcup C_{1+2((q+e-fa-\frac{a}{2})a'+a'-1-f)}\). Note that \(\underline{q+e-fa-\frac{a}{2}}\cap \underline{e}\ne \emptyset \) and \([0, a'-1]=\underline{a'-1-f}\cap \underline{f}\ne \emptyset \). Suppose that \(T_2\bigcap -qT_2\ne \emptyset \), there must hold that \(a'-1-f\ge \lceil \frac{q+e-fa-\frac{a}{2}-\frac{a}{2}}{a}\rceil >a'-1-f\), a contradiction.

Case 2: If \(e\in [\frac{a+2}{2}, q-\frac{a+2}{2}]\) and \(f\in [\lceil \frac{e-\frac{a}{2}}{a}\rceil , a'-1]\), then denote that \(e'=e-\frac{a}{2}\in [1, a(a'-1)]\) and \(f'\in [\lceil \frac{e'}{a} \rceil , a'-1]\). Similar to Case 2 of Lemma 3, one can seek a contradiction to \(T_2\bigcap -qT_2\ne \emptyset \) readily.

The proof is complete. \(\square \)

The following theorem shows value of \(|T_{ss}|\), which is useful to confirm the number of entanglement bits.

Theorem 4

Let \(n, q, a, a'\) be given as above. Keep the notations defined in Lemma 6. If \({\mathcal {C}}\) is a negacyclic code with defining set \(T=C_1\bigcup C_3\bigcup \cdots \bigcup C_{1+2(\beta a'+a'-1)}\), where \(\beta \in [0, q]\), then

$$\begin{aligned} |T_{ss}|=\left\{ \begin{array}{ll} 0 &{}\text{ for }\ \beta \in \left[ 0, \frac{a}{2}\right] ;\\ \sum \limits _{k=\frac{a+2}{2}}^{\beta }2\left\lceil \frac{k-\frac{a}{2}}{a}\right\rceil &{}\text{ for }\ \beta \in \left[ \frac{a+2}{2}, q\right] .\\ \end{array}\right. \end{aligned}$$

Proof

See in “Appendix 2”. \(\square \)

Summarizing those observations above, we can finish this section with the following theorem, which is helpful to construct EAQEC codes of length n with large minimum distance from negacyclic codes.

Theorem 5

Let \(n, q, a, a'\) be given as above. Keep the notations defined in Lemma 6 and  Theorem 4. There exist EAQEC codes with parameters \([[n, n-2(d-1)+c, d; c]]_q\), where

$$\begin{aligned} \left\{ \begin{array}{ll} d\in \left[ 2, \frac{(a+2)a'}{2}+1\right] ,\quad c=0 &{} \\ d\in \left[ \beta a'+\left\lceil \frac{\beta -\frac{a}{2}}{a}\right\rceil +1, (\beta +1)a'+1\right] ,\quad c=\sum \limits _{k=\frac{a+2}{2}}^{\beta }2 \left\lceil \frac{k-\frac{a}{2}}{a}\right\rceil &{}\text{ for }\ \beta \in \left[ \frac{a+2}{2}, q-\frac{a}{2}-1\right] ;\\ d=n+1,\quad c=n &{}\text{ for }\ \beta =q.\\ \end{array}\right. \end{aligned}$$

Particularly, for \(\beta \in [0, \frac{q-1}{2}]\), these EAQEC codes are EAQMDS codes.

Proof

From those consequences of Lemma 6 and Theorem 4, one can construct series of EAQEC codes based on Theorem 1 directly. When \(d\le \frac{n+2}{2}\), these codes are optimal. The process of proof is similar to that of Theorem 3 and is omitted here. \(\square \)

5 Code comparisons and conclusions

In this paper, by investigating \(q^2\)-cyclotomic cosets modulo rn, we construct a family of EAQEC codes with length n, where q is a prime power, \(n=\frac{q-1}{a}(q+1), a\mid (q-1)\) and \(r=1\) or 2. Note that each coset contains only one element. Naturally, any EAQEC code derived in this paper achieves EA-Singleton bound and is optimal if its minimum distance \(d\le \frac{n+2}{2}\). Furthermore, our construction could produce many new EAQEC codes with large minimum distance that are not covered in the literature.

In order to obtain QMDS or EAQMDS codes with big minimum distance, many scholars restricted their attention to studying constacyclic codes or GRS codes of length \(n\le q^2+1\). Indeed, lots of consequences on codes with length \(n\mid (q^2-1)\) have been made, see Refs. [11,12,13,14,15,16,17,18,19, 23, 26, 28,29,30]. However, most of conclusions in those above researches required many corresponding conditions, such as an odd prime power q, \(n=\lambda (q+1)\) with \(\lambda \) an odd divisor of \(q-1\) in [13], an odd prime power \(q=2tm+1\), \(n=\frac{q^2-1}{2t}\) in [16] and an odd prime power \(q\equiv 1\bmod 2a\) with \(a\ge 3\), \(n=\frac{q-1}{2a}(q+1)\) in [28] and so on. Our construction comes into existence under only one condition, i.e., \(a\mid (q-1)\). Clearly, given the same length n, our conclusions generalize those results in [11,12,13,14,15,16,17,18,19, 23, 26, 28,29,30] evidently.

To make comparisons with the known codes clearly, we enumerate examples of EAQEC codes of length \(n=\frac{q-1}{a}(q+1)\) in Tables 123456, where \(a\in [1,6]\). For even a, EAQEC codes in part (a) of Table a are obtained from cyclic codes by Theorem 3, while EAQEC codes in part (b) of Table a are derived from negacyclic codes by Theorem 5. Symbols \(*\) and \(\diamondsuit \) in the tables denote that those corresponding codes are new EAQMDS codes and new EAQEC codes, respectively.

As shown in Tables 123456, for given length n, our construction is prior to those already known ones. Specifically, many known constructions of EAQEC codes are applicable for big and specific q, which might be empty of practicality. Nevertheless, those codes produced by their construction have shorter minimum distance than ours. In other words, the bigger q is, the larger minimum distance of our EAQEC codes could have. Moreover, quite a lot of known results can be seemed as some special cases of ours in Theorems 3 and 5.

Practically, it is difficult to construct EAQEC codes with flexible good parameters. Whereas, we present a family of EAQEC codes whose required number of entanglement bits is flexible. We believe that our method of studying EAQEC codes employed in this paper can facilitate more good results in the future.