1 Introduction

Quantum error-correcting codes (QECCs) are mostly defined using classical linear codes [4, 13]. They were first introduced over the binary field and then the construction was extended to an arbitrary finite field [15]. Namely, QECCs over \({\mathbb {F}}_q\), the finite field with q elements, are usually constructed from self-orthogonal classical codes. We can consider classical codes over \({\mathbb {F}}_q\) if we decide to use the Euclidean metric, and over \({\mathbb {F}}_{q^2}\), when using the Hermitian metric.

Brun et al. [2] proposed to share entanglement between encoder and decoder to simplify the theory of quantum error-correction and increase the communication capacity, giving rise to entanglement-assisted quantum error-correcting codes (EAQECCs). An important advantage of this new construction is that one may consider an arbitrary classical linear code, without the self-orthogonality restriction. EAQECCs were also first defined over the binary field and then the construction was extended to an arbitrary finite field [11].

The main difficulty for determining the parameters of an EAQECC, with respect to QECCs, is the computation of the parameter c, the minimum number of required maximally entangled quantum states in \({\mathbb {C}}^q \otimes {\mathbb {C}}^q\). Computationally speaking, given a concrete EAQECC, the computation of c is not intense but it is a difficult task to provide a formula for a given family of codes. This is the main goal of the article.

Several articles have explored the construction of EAQECCs from classical linear codes as binary BCH codes [8, 18, 21], constacyclic codes [17, 27], constacyclic LCD codes [24], cyclic codes [25], generalized Reed–Solomon codes [14, 19, 20], negacyclic BCH codes [6, 7] and algebraic-geometry codes [23]. These papers address particular cases and determine their parameters but no general formula for the parameters of EAQECCs using the previous families of codes is known. A more general procedure is given in [22], which provides parameters for EAQECCs obtained from Reed–Solomon (RS) codes both for the Euclidean and Hermitian metric, however not all RS codes in the Hermitian case are considered. In this regard and in this paper, we give a formula for the parameters of all the EAQECCs that can be obtained from RS codes with respect to the Hermitian metric (see Sect. 4).

The main aim of this article is to consider BCH codes over an arbitrary field \({\mathbb {F}}_q\), that can be understood as cyclic codes but also as subfield subcodes of RS codes. We consider BCH codes defined from consecutive cyclotomic cosets and hence we can bound their minimum distance by the well-known BCH bound. We give a complete and explicit formula for the parameters of the EAQECCs coming from any BCH code (defined by consecutive cyclotomic cosets) with extension degree 2, both for the Euclidean and the Hermitian metric. Moreover, we also determine the parameters when we extend the classical codes by evaluating at zero. With our formulae, the reader can easily determine the parameters of the EAQECCs obtained as mentioned.

The computation of c is performed following the geometric decomposition of a linear code [26], that was stated in [11] for EAQECCs. The computations are carried out by a careful analysis of the involved cyclotomic cosets and the q-adic decomposition of its elements that allow us to compute the geometric decomposition of a linear code. The geometric decomposition of a linear code endowed with an inner product provides a basis of the code included in a specific basis of the ambient linear space. This last basis \(\{v_i\}_{i\in I}\) satisfies that each \(v_i\) is either orthogonal to \(v_j\) for all \(j \ne i\) (symmetric) or orthogonal to \(v_j\) for all j except for a unique reciprocal element \(v_k\) with \(k \ne i\) (asymmetric). This means that one can determine the hull, or radical, of the linear code easily. In this article, we compute such a decomposition by identifying symmetric and asymmetric cosets (see Definition 4) with respect to the inner product considered. We notice that the method is similar to the one in [18] for quaternary BCH codes.

In Sect. 5, we give a general formula for the parameters of EAQECCs coming from BCH codes with the Euclidean metric and extension degree 2. We show that they have parameters that are worse than the ones obtained with RS codes with Hermitian metric (studied in Sect. 4). Namely, they have the same length, \(q^2-1\) or \(q^2\), and bound for the minimum distance but the dimension is lower for BCH codes with the Euclidean metric. However, BCH codes with the Euclidean metric have still some interest since one may obtain codes whose parameter c is greater than the one obtained with RS codes. In this way, we increase the constellation of known EAQECCs that is limited at this moment. Moreover, the computation of c for BCH codes with the Euclidean metric helps understanding the computation of c for BCH codes with the Hermitian metric treated in Sect. 6, that is rather technical.

Finally, the main results of this article are given in Sect. 6, where BCH codes with the Hermitian metric and extension degree 2 are considered. We give a completely general formula for their parameters. Furthermore, using that formula we present some EAQECCs with good parameters, by giving tables of them over different finite fields whose parameters exceed the Gilbert–Varshamov (GV) bound [11]. We also compare their parameters with the codes available in the literature, when it is possible. We obtain long codes over \({\mathbb {F}}_q\), with length \(q^4-1\) and \(q^4\), and with good parameters \([[n,k,d;c]]_q\). Our codes satisfy \(k >c\) and thus, they give rise to catalytic quantum codes [3]. Note that one cannot consider the Singleton bound, \(n+2 \ge k + 2d + c\), for EAQECCs defined over a non-binary field since that bound is only proved for codes defined over a binary field with \(d \le (n+2)/2\) [16], despite several articles in the literature consider it for arbitrary fields.

The article is organized as follows: we introduce RS and BCH codes in Sect. 2 and EAQECCs coming from them in Sect. 3. Section 4 is devoted to the study of EAQECCs from RS codes with respect to the Hermitian metric. To conclude, EAQECCs obtained from BCH codes with extension degree 2 are presented in Sect. 5 in the Euclidean case and in Sect. 6 for the Hermitian case.

2 RS and BCH codes

We introduce RS codes and BCH codes in this section. We regard BCH codes as subfield subcodes of evaluation codes as in [1, 5] instead of as cyclic codes. This construction has the advantage that it can be extended to evaluation by polynomials in several variables.

Let p be a prime number and consider the finite field \({\mathbb {F}}_{p^\ell }\) with \(p^\ell \) elements. Let \(n = p^\ell -1\) and \({\mathbb {F}}_{p^\ell }[X]\) the ring of polynomials in one variable with coefficients in \({\mathbb {F}}_{p^\ell }\). Consider classes of univariate polynomials in the quotient ring \({\mathbb {F}}_{p^\ell } [X]/J\), where J is the ideal of \({\mathbb {F}}_{p^\ell }[X]\) generated by \(X^{n} -1\). Define

$$\begin{aligned} \mathrm {ev}: {\mathbb {F}}_{p^\ell }[X]/J \rightarrow {\mathbb {F}}_{p^\ell }^{n}; ~ \;\; \mathrm {ev}(f) = \left( f(P_1), f(P_2), \ldots , f(P_{n}) \right) , \end{aligned}$$

where \(Z=\{P_1, P_2, \ldots , P_n\}\) is the zero locus of J in \({\mathbb {F}}_{p^\ell }\). Let \(\varDelta \) be a subset of \({\mathcal {H}}:=\{0,1, \ldots , n-1 \}\). Then, the RS code, \(D_\varDelta \subseteq {\mathbb {F}}_{p^\ell }^n\), is the code generated by

$$\begin{aligned} \left\{ \mathrm {ev}\left( X^i\right) \; | \; i \in \varDelta \right\} . \end{aligned}$$

Usually, one considers \(\varDelta = \{0,1, \ldots , k-1\}\) and the RS code has parameters \([p^\ell -1,k,p^\ell -k]_q\). Moreover, one can extend the previous code by evaluating at 0 as well and therefore, one obtains a code with parameters \([p^\ell ,k,p^\ell +1-k]_q\).

Let r be a positive integer such that r divides \(\ell \). We consider first codes over the field \({\mathbb {F}}_{p^\ell }\) and then their subfield subcodes over the field \({\mathbb {F}}_{p^r}\). BCH codes can be defined as subfield subcodes of the form \(D_\varDelta \cap ({\mathbb {F}}_{p^r})^n\) and extend RS codes in the sense that one can consider that a RS code is a BCH with extension degree one, that is, \(r=\ell \). This is why we may consider the same notation for both families of codes in this article.

In the ring \({\mathbb {Z}}_{n}\), we consider minimal cyclotomic cosets with respect to \(q=p^r\), minimal means that it contains exactly the elements of the form \(xq^t\), \(t \ge 0\), in \({\mathbb {Z}}_{n}\) for some \(x \in {\mathbb {Z}}_{n}\) under the identification \({\mathbb {Z}}_{n} = {\mathcal {H}}\). We denote by \(I_x\) the minimal cyclotomic coset \(\{ xq^t: t \ge 0 \}\). For every minimal cyclotomic coset, pick its least element, then let \({\mathcal {A}}\) be the set of all minimal representatives and \(\{I_{x}\}_{ x \in {\mathcal {A}}}\) is the set of minimal cyclotomic cosets with respect to q. Moreover, let \(i_{x} := \# (I_{x})\), with \(\#\) denoting the cardinality of a set. For convenience, we write

$$\begin{aligned} {\mathcal {A}} = \{m_0 = 0< m_1< m_2 < \cdots \} = \{m_j\}_{j=0}^z. \end{aligned}$$

We will use the following two results which can be found in [9, 10].

Proposition 1

Set \(\varDelta = \cup _{j=t'}^t I_{m_j}\), \(t' < t\). Then, the subfield subcode of \(D_\varDelta \) over \({\mathbb {F}}_q\),

$$\begin{aligned} E_\varDelta = D_\varDelta |_{{\mathbb {F}}_{q}} = E_\varDelta \cap ({\mathbb {F}}_{q})^n, \end{aligned}$$

has dimension \(\sum _{j=t'}^{t} i_{m_j}\).

The forthcoming Proposition 2 uses duality with respect to the two metrics we consider in this work. These metrics are induced by two inner products: the Euclidean inner product, where \(x\cdot y = \sum _{i=1}^n x_i y_i\) and the source code is defined over the finite field with q elements, and the Hermitian inner product, where \(x\cdot y = \sum _{i=1}^n x_i y_i^q\) and the source code is defined over the finite field with \(q^2=p^r\) elements (for a suitable r that divides \(\ell \)); in this last case, we have to replace q with \(q^2\) in the above description. Both cases, will allow us to obtain EAQECCs over the finite field with q elements by [11].

For the sake of clarity, we consider a toy example through the article only for illustrating the main concepts and notation.

Example 1

Let \(p=2\), \(\ell =4\) and \(r=2\). We consider the Hermitian inner product, thus \(q^2=p^r=4\) and \(n=p^\ell -1=15\). The cyclotomic cosets in \({\mathbb {Z}}_{15}\) with respect to 4 are:

$$\begin{aligned}&I_{0}=\{0\},~I_1=\{1,4\},~I_2=\{2,8\},~I_3 = \{3,12\},~I_5= \{5\}, \\&I_6=\{6,9\},~I_7 = \{7,13\},~I_{10}=\{10\},~I_{11}=\{11,14\}. \end{aligned}$$

And therefore, the set of all minimal representatives is \({\mathcal {A}}=\{ 0,1,2,3,5,6,7,10,11\}\).

\(\square \)

Proposition 2

The minimum distance of the (Euclidean or Hermitian) dual code of \(E_\varDelta \), \(C_\varDelta \), where \(\varDelta = \cup _{j=0}^t I_{m_j}\), is larger than or equal to \(m_{t+1}+1\) (BCH bound).

Therefore, for \(\varDelta = \Delta (t) = \cup _{j=0}^t I_{m_j}\), the code \(C_\varDelta \) is known as a BCH code and it has parameters \([n, n - \sum _{j=0}^{t} i_{m_j}, \ge m_{t+1}+1 ]_{p^r}\).

For the Euclidean case, set \(I_x^\bot := I_{n-x}\) and define

$$\begin{aligned} \Delta (t)^\bot:= & {} (I_{m_0} \cup I_{m_1} \cup \cdots \cup I_{m_t})^\bot \\:= & {} {\mathcal {H}} {\setminus } (I_{m_0}^\bot \cup I_{m_1}^\bot \cup \cdots \cup I_{m_t}^\bot )\\= & {} {\mathcal {H}} {\setminus } (I_{n-m_0} \cup I_{n-m_1} \cup \cdots \cup I_{n-m_t}). \end{aligned}$$

Analogously, for the Hermitian case with base field \({\mathbb {F}}_{q^2}\), we set \(I_x^\bot := I_{n-qx}\) and \(\Delta (t)^\bot := {\mathcal {H}} {\setminus } (I_{n-qm_0} \cup I_{n-qm_1} \cup \cdots \cup I_{n-qm_t})\). With the above notations, by [9, 12], it holds

$$\begin{aligned} C_{\Delta (t)} = E_{\Delta (t)}^\bot = E_{\Delta (t)^\bot }. \end{aligned}$$

Example 2

This is a continuation of Example 1 with \(p=2\), \(\ell =4\), \(r=2\), \(q^2=4\) and \(n=15\), we consider the Hermitian inner product. Let \(t=6\), then \(m_6=7\) and

$$\begin{aligned} \Delta (6)=I_0\cup I_1\cup I_2\cup I_3\cup I_5\cup I_6\cup I_7. \end{aligned}$$

Moreover, we have that

$$\begin{aligned} \Delta (6)^\bot= & {} {\mathcal {H}} {\setminus } (I_{n-0q} \cup I_{n-1q} \cup I_{n-2q} \cup I_{n-3q} \cup I_{n-5q} \cup I_{n-6q} \cup I_{n-7q})\\= & {} \{0,1, \ldots , 14\} {\setminus } (I_{0} \cup I_{7} \cup I_{11} \cup I_{6} \cup I_{5} \cup I_{3} \cup I_{1})\\= & {} I_2 \cup I_{10}. \end{aligned}$$

Therefore, \(C_{\Delta (6)}=E_{\Delta (6)^\bot }\) has parameters \([15, 3, 11 ]_4\). \(\square \)

As for RS codes, we can extend BCH codes by evaluating at 0 as well. Then, we obtain a code with parameters \([n+1, n+1 - \sum _{j=0}^{t} i_{m_j}, \ge m_{t+1}+1 ]_{p^r}\). In this paper, we only consider extension degree 1 or 2 (i.e., \(\ell =r\) or \(\ell = 2r\)) and the length n of our codes will be \(p^\ell -1\) or \(p^\ell \).

3 EAQECC

We compute in this section parameters of entanglement-assisted quantum error-correcting codes coming from RS codes and BCH codes. As we have mentioned in the previous section, for easing the notation, we consider RS codes as BCH codes with extension degree 1. That is, for RS codes one has that \(r=\ell \), \(n=p^\ell -1=p^r-1\), and all the cyclotomic cosets have size 1.

From Corollary 1 and Theorem 4 in [11], we have

Theorem 3

Let E be a linear code over \({\mathbb {F}}_{q}\) (over \({\mathbb {F}}_{q^2}\)) with length n and dimension k and let C be its Euclidean (Hermitian) dual code that has minimum distance d. Then, there exists an EAQECC with parameters

$$\begin{aligned}{}[[n,n-2k+c,d;c]]_q, \end{aligned}$$

where \(c= \dim E - \dim (E \cap C)\).

This implies that, for \(\varDelta = \Delta (t)= \cup _{j=0}^t I_{m_j}\), there exists an EAQECC with parameters

$$\begin{aligned} \left[ \left[ n,n-2\sum _{j=0}^{t} i_{m_j}+c,\ge m_{t+1}+1;c\right] \right] _q. \end{aligned}$$

Hence, the only task for completely determining its parameters remains computing c.

It is not feasible to give a formula for c in the general case. The aim of this article is to provide closed formulas for extension degree equal to 1 (RS codes) and 2. Thus, assuming that we do not evaluate at 0, in the first case \(\ell =r\), \(n=q-1\) when considering codes over \({\mathbb {F}}_q\) and Euclidean duality and \(n=q^2-1\) when we use codes over \({\mathbb {F}}_{q^2}\) and Hermitian duality, and in the second case \(\ell = 2r\), \(n=q^2-1\) when we consider subfield subcodes over \({\mathbb {F}}_q\) from codes over \({\mathbb {F}}_{q^2}\) and Euclidean duality and \(n=q^4-1\) when we use subfield subcodes over \({\mathbb {F}}_{q^2}\) from codes over \({\mathbb {F}}_{q^4}\) and Hermitian duality.

For RS codes, one can find a formula for c in [22] for the Euclidean case and a partial result for the Hermitian case. We give a general formula for the Hermitian case in the next section. First, we need to introduce some notation.

Definition 4

We say that a minimal cyclotomic coset is symmetric if \(I_x^\bot = I_{n-x} = I_{x}\) in the Euclidean case (\(I_x^\bot = I_{n-qx} = I_{x}\), in the Hermitian case), and asymmetric otherwise. Let \(I_x\) be asymmetric and \(I_y = I_{n-x}\) (\(I_y = I_{n-qx}\), in the Hermitian case). Moreover, assume that x and y are the minimal representatives of \(I_x\) and \(I_y\), respectively. Without loss of generality, we may assume that \(x<y\), then we say that \(I_x\) and \(I_y\) are asymmetric reciprocal cosets, that \(I_x\) is the first reciprocal asymmetric coset (FR-asymmetric coset) and that \(I_y\) is the second reciprocal asymmetric coset (SR-asymmetric coset).

Let \(I_R\) consists of the asymmetric cosets in \(\varDelta \) whose reciprocal coset does not belong to \(\varDelta \) and \(I_L\) of the symmetric cosets in \(\varDelta \) and the asymmetric cosets whose reciprocal coset belongs to \(\varDelta \) as well. We have that \(\varDelta =\Delta (t) = I_R \sqcup I_L\) (that is, \(\varDelta =I_R \cup I_L\) and \(I_R \cap I_L = \emptyset \)), and in this way it holds that \(E_{I_R} = E_{\varDelta } \cap E_{\varDelta }^\bot \) is the hull, or radical, of \(E_{\varDelta }\) since \(E_{\varDelta }^\bot = E_{\varDelta ^\bot }\) (see the paragraph after Proposition 2). Note that \(I_R\) and \(I_L\) are a union of minimal cyclotomic cosets. In this way, the value c is given by \(\# I_L\) (see Sect. 2 in [11] for more details) since

$$\begin{aligned} c = \dim E_{\varDelta } - \dim \left( E_{\varDelta } \cap C_{\varDelta } \right) = \# \varDelta - \#(\varDelta \cap \varDelta ^\bot )=\# \varDelta - \# (I_R) = \# (I_L). \end{aligned}$$

For a cyclotomic coset \(I_x\) that belongs to \(I_R\), we have that \(I_x \subseteq \varDelta ^\bot \) and, on the other hand, for a cyclotomic coset \(I_x\) that belongs to \(I_L\), we have that \(I_x \not \subseteq \varDelta ^\bot \). Therefore, for obtaining regular quantum codes, one considers a set \(\varDelta \) such that \(I_L =\emptyset \) and hence \(E_{\varDelta } \subseteq E_{\varDelta }^\bot \). On the contrary, for constructing LCD codes, one considers a set \(\varDelta \) such that \(I_R = \emptyset \) and hence \(E_{\varDelta } \cap E_{\varDelta }^\bot = \{0\}\).

Remark 5

Notice that since we are considering consecutive minimal cyclotomic cosets for constructing our codes, the cardinality of \(I_L\) will be given by the cardinality of the symmetric cosets in \(\varDelta \) plus two times the cardinality of the SR-asymmetric cosets in \(\varDelta \).

Example 3

This is a continuation of Examples 1 and 2, with \(p=2\), \(\ell =4\), \(r=2\), \(q^2=4\), \(n=15\), \(t=6\) and \(m_6=7\), where we consider the Hermitian inner product.

The symmetric cosets in \({\mathbb {Z}}_{15}\) are \(I_0=\{0\}\), \(I_5=\{5\}\), \(I_{10}=\{10\}\) and the pairs of asymmetric cosets are: \(I_1=\{1,4\}\) (FR-asymmetric) and \(I_7=\{7,13\}\) (SR-asymmetric), \(I_2=\{2,8\}\) (FR-asymmetric) and \(I_{11}=\{11,14\}\) (SR-asymmetric), and \(I_3 = \{3,12\}\) (FR-asymmetric) and \(I_6=\{6,9\}\) (SR-asymmetric).

Thus, for \(\varDelta = \Delta (6) = I_0\cup I_1\cup I_2\cup I_3\cup I_5\cup I_6\cup I_7 = I_R \sqcup I_L\), we have that

$$\begin{aligned} I_R = I_2, \quad \text{ and }\quad I_L = I_0\cup I_1\cup I_3\cup I_5\cup I_6\cup I_7, \end{aligned}$$

because \(I_L= I_2\) since \(I_2\) is an FR-asymmetric coset whose reciprocal coset, \(I_{11}\), does not belong to \(\varDelta \) and because \(I_L\) is a union of symmetric cosets, \(I_0\) and \(I_5\), and pairs of asymmetric cosets, \(I_1\) and \(I_7\) and \(I_3\) and \(I_6\) included in \(\varDelta \). Therefore, \(c= \# I_L = 10\). Moreover, by Remark 5, one can alternatively compute c by considering the cardinality of the symmetric cosets, \(I_1\) and \(I_5\), plus two times the cardinality of the SR-asymmetric cosets, \(I_6\) and \(I_7\) in \(\varDelta \): \(1+1+2(2+2)=10\). This second form of computing c is the method that we follow in the rest of the article to obtain a general formula for c. In particular, for this code, c may be computed following our forthcoming Theorem 26, case (2), since \((q^4-1)/(q+1)=5\le m_t < q^3+q=10\).

Finally, one has that considering \(\varDelta =\Delta (6)\), one obtains an EAQECC with parameters

$$\begin{aligned} \left[ \left[ n,n-2\sum _{j=0}^{t} i_{m_j}+c,\ge m_{t+1}+1;c\right] \right] _2=\left[ \left[ 15,1,\ge 11; 10\right] \right] _2. \end{aligned}$$

\(\square \)

Furthermore, we can also consider RS codes and BCH codes where we evaluate at zero to construct EAQECC, that is, the ideal J at the beginning of Sect. 2 is generated by \(X^{n+1} -X\). In this case, we obtain an EAQECC with parameters

$$\begin{aligned} \left[ \left[ n+1,n-2\sum _{j=0}^{t} i_{m_j}+c,\ge m_{t+1}+1;c-1\right] \right] _q, \end{aligned}$$

because the length is increased by one unit and the parameter c is decreased by one unit since the cyclotomic coset \(I_0=\{0\}\) is symmetric when we do not evaluate at zero and it is FR-asymmetric otherwise by [9] (because the reciprocal coset of \(I_0 = \{0\}\) is \(I_{n}\) that is not contained in \({\mathcal {H}}\)). The dimension of the EAQECC remains therefore the same as before. This allows us to increase the constellation of codes that we may construct.

4 Hermitian RS codes

We give in this section a general formula for c in the case of EAQECCs coming from RS codes with respect to the Hermitian metric.

Theorem 6

Let \(\varDelta = \{ 0,1, \ldots , t\} \subseteq {\mathcal {H}}\) and consider the RS code \(D_\varDelta = E_\varDelta \) over \({\mathbb {F}}_{q^2}\). Let \(b_0 + b_1 q\) be the q-adic expression of t, then the parameters of the corresponding EAQECC are:

$$\begin{aligned}{}[[q^2-1,(q-b_1)^2-2b_0-2,t +2; b_1^2+1]]_q \end{aligned}$$

when \(b_0 +b_1 < q-1\). And

$$\begin{aligned}{}[[q^2-1,(q-b_1-1)^2, t +2; b_1^2 + 2(b_0 + b_1 - q ) + 4]]_q \end{aligned}$$

otherwise (\(b_0 + b_1 \ge q-1\)).

Proof

We start by noticing that, in this case and with the notation as in Sect. 2, every considered coset has cardinality one and \(m_t =t\). By Theorem 3, it suffices to compute the value c corresponding to the entanglement and by Remark 5 we need to decide which values a in \(\varDelta \) determine a symmetric coset (contributing one to c) and which ones determine SR-asymmetric cosets (contributing two in the computation of the value c).

Let \(a \in \varDelta \), with q-adic expression \(a=a_0 + a_1 q\), then a represents an SR-asymmetric (respectively, a symmetric) coset if and only if \(a_0 + a_1 < q-1\) (respectively, \(a_0 + a_1 = q-1\)). Indeed, a represents an SR-asymmetric (respectively, a symmetric) coset if and only \((q^2-1) -qa <a\) (respectively, \((q^2-1) -qa =a\)). Noticing that the q-adic expression of \(q^2-1\) is \((q-1)q + (q-1)\) and that of qa is \(qa=a_1 + a_0 q\), the result follows straightforwardly.

Then, for computing c we only need to compute twice number of values (in \(\varDelta \)) \(a=a_0 + a_1 q\), \(0 \le a_0, a_1 \le q-1\) such that \(a_0+a_1 \ge q- 1\) plus the number of values (in \(\varDelta \)) \(a=a_0 + a_1 q\), \(0 \le a_0, a_1 \le q-1\) such that \(a_0+a_1 = q- 1\).

\(\varDelta \) contains the number 0 whose coset is symmetric, thus we add 1 to our computations.

The number of elements a giving rise to symmetric cosets satisfying \(a_1 \le b_1 -1\) equals to \(b_1\) because each value \(a_1\) determines the corresponding \(a_0\).

Next, we compute how many values a satisfy \(a_0+a_1 \ge q- 1\) and \(a_1 \le b_1 -1\). Since for any fixed \(a_1\), it holds that \(a_0\) satisfies \(q-1-a_1 < a_0 \le q-1\), the number of solutions is \(\sum _{a_1=0}^{b_1-1} a_1\). This sum equals \((1/2) b_1 (b_1-1)\) giving a contribution to c of \(b_1 (b_1-1)\). We have proved the first part of the result because we have obtained \(c= 1 + b_1 (b_1-1) + b_1 = 1 + b_1^2\). Note that we cannot obtain \(a_0 + a_1 \ge q-1\) when \(b_0 + b_1 < q-1\) and \(a_1=b_1\).

For proving our second statement, where \(b_0 + b_1 \ge q-1\), it suffices to add to the value \(1 + b_1^2\) twice the number of integers a with q-adic expression \(a_0 + b_1 q\), \(a_0 \le b_0\), such that \(a_0 + b_1 > q-1\) plus the number of integers a with q-adic expression \(a_0 + b_1 q\) such that \(a_0 + b_1 = q-1\), which is exactly one. As a consequence,

$$\begin{aligned} c= 1 + b_1^2 + 2(b_0 + b_1 - q +1) + 1 = b_1^2 + 2(b_0 + b_1 - q ) + 4. \end{aligned}$$

\(\square \)

Considering the ideal J introduced in Sect. 2 but now generated by \(X^{n+1} -X\) instead of \(X^{n} -1\), a very similar argument proves the following result.

Theorem 7

Let \(\varDelta = \{ 0,1, \ldots , t\} \subseteq {\mathcal {H}}\) and consider the RS code \(D_\varDelta = E_\Delta \) over \({\mathbb {F}}_{q^2}\). Set \(t=b_0 + b_1 q\), then the parameters of the corresponding EAQECC are:

$$\begin{aligned}{}[[q^2,(q-b_1)^2-2b_0-2,t +2; b_1^2]]_q \end{aligned}$$

when \(b_0 +b_1 < q-1\). And

$$\begin{aligned}{}[[q^2,(q-b_1-1)^2,t +2; b_1^2+ 2(b_0+b_1-q)+3]]_q \end{aligned}$$

otherwise (\(b_0 + b_1 \ge q-1\)).

Remark 8

In [22, Theorem 5], parameters for EAQECCs with length \(q^2\) coming from Reed–Solomon codes were given for some intervals. Hence, our Theorem 7 extends [22, Theorem 5] in the sense that we consider all possible cases.

5 Euclidean BCH EAQECC with extension degree 2

We consider in this section BCH codes over \({\mathbb {F}}_q\) with extension degree equal to 2. Hence, the cyclotomic cosets have one or two elements. Namely, \(n= q^2-1\), \(q=p^r\) and \(l=2r\), and the cyclotomic coset whose minimal representative is x is equal to \(I_x= \{x,xq\}\). In addition, its reciprocal cyclotomic coset is \(I_{n-xq} = \{n-xq,n-x\}\), where \(n-xq\) is the minimal representative of \(I_{n-qx}\) since \(x \le xq\). Moreover, \(I_x\) has cardinality 1 if and only if \(x = xq\).

Lemma 9

Let \(I_x\) be such that x is its minimal representative. One has that

  • \(I_x\) is an FR-asymmetric coset if and only if \(n - xq > x\).

  • \(I_x\) is a symmetric coset if and only if \(n-xq = x\).

  • \(I_x\) is an SR-asymmetric coset if and only if \(n - xq < x\).

Proof

We have that \(I_{n-qx}\) is the reciprocal coset of \(I_x\) and that \(n-xq\) is the minimal representative of \(I_{n-qx}\). Hence, one has that

$$\begin{aligned} I_x = I_{n-x}~\text{ if } \text{ and } \text{ only } \text{ if }~ n-xq =x. \end{aligned}$$

Let \(I_x\) be asymmetric, then \(x \ne n-xq\) (otherwise it would be symmetric). Then, \(I_{x}\) is an SR-asymmetric cyclotomic coset if \(x > n -xq\), otherwise it is an FR-asymmetric cyclotomic coset. \(\square \)

The following proposition characterizes symmetric and SR-asymmetric cosets by the q-adic representation of its minimal representative.

Proposition 10

Let \(I_x\) be such that x is its minimal representative. Let \(x=a_0 + a_1 q\) with \(0\le a_0,a_1 < q\), the q-adic representation of x. Then,

  • \(I_x\) is a symmetric coset if and only if \(a_0 + a_1 = q-1\).

  • \(I_x\) is an SR-asymmetric coset if and only if \(a_0 + a_1 > q-1\).

Proof

By Lemma 9, we have that \(I_x\) is symmetric if and only if \(n-xq = x\). That is, if \(n - (a_0 + a_1 q)q = a_0 + a_1 q\), that is equivalent to \(n = (a_0 + a_1) (q+1)\) since \(q^2\) is equivalent to 1 modulo \(q^2-1\). Moreover, since \(n=q^2-1\), we have that \(I_x\) is a symmetric coset if \(a_0 + a_1 = q-1\).

By Lemma 9, we have that \(I_x\) is an SR-asymmetric coset if and only if \(n-xq < x\). That is, if \(n - (a_0 + a_1 q)q < a_0 + a_1 q\), that is equivalent to \(n < (a_0 + a_1) (q+1)\). Thus, we have that \(I_x\) is an SR-symmetric coset if and only if \(a_0 + a_1 > q-1\). \(\square \)

For computing c, first we compute how many minimal cyclotomic cosets are symmetric or SR-asymmetric. Afterward, we will determine the number of symmetric and FR-asymmetric cosets and their cardinality. The coset \(I_0\) is always in \(I_L\) since it is symmetric and hence, it will not be considered in the following computations. We have a characterization of the cyclotomic cosets in \(I_L\) by Proposition 10, namely \(a_0 + a_1 \ge q-1\) (i). Moreover, given a cyclotomic coset \(I_x\) we should check whether the cyclotomic coset \(I_x\) is in \(\varDelta =\Delta (t) = \cup _{j=0}^{t} I_{m_j}\), that is, we should check that \(x \le m_t\) (ii). Finally, we should consider that x is a minimal representative of \(I_x\), which is equivalent to \(a_0 \ge a_1\) (iii), since \(x = a_0 + a_1 q \le a_1 + a_0 q = xq\) if and only if \(a_0 \ge a_1\).

Summarizing, setting \(b_0 + b_1q\) the q-adic expression of \(m_t\), we have to count the number of elements \(a_0 + a_1q\), with \(0 \le a_0, a_1 \le q-1\) (and \((a_0,a_1) \ne (0,0)\)), such that

  1. (i)

    \(a_0 + a_1 \ge q-1\),

  2. (ii)

    \(a_0 + a_1 q \le b_0 + b_1 q\), and

  3. (iii)

    \(a_0 \ge a_1\).

We first consider the case \(a_1 < b_1\). Note that in this case, condition (ii) always holds. Our strategy consists of computing the number of pairs that satisfy (i) and then subtracting the number of pairs that do not satisfy (iii). Let \(a_1 =i\), with \(i \in \{0, 1, \ldots , b_1-1\}\). We have that (i) is equivalent to \(q-1-i \le a_0 \le q-1\) and hence the number of possible values for \(a_0\) is \(i+1\) and the total number of possible values for \(a_0\) and \(a_1\) is

$$\begin{aligned} \sum _{i=0}^{b_1-1} i+1 = \frac{b_1(b_1+1)}{2}.\end{aligned}$$
(1)

Now we consider pairs that do not satisfy equation (iii), that is, \(a_0 < a_1\). Again, let \(a_1 =i\), with \(i \in \{0, 1, \ldots , b_1-1\}\), thus we have that \(q-1-i \le a_0 \le i-1\). Note that the previous inequalities are satisfied only when \((i-1) - (q-1-i) +1 = 2i -q +1 \ge 1\), that is, when \(i \ge q/2\). This is equivalent to \(i \ge q/2\) when the characteristic is 2 and \(i \ge (q+1)/2\) when the characteristic is odd. Summarizing, both inequalities are equivalent to \(i \ge \lceil q/2 \rceil \) in arbitrary characteristic. Thus, the total number of pairs that satisfy (i) and do not satisfy (iii) is equal to

$$\begin{aligned}&\sum _{i=\lceil q/2 \rceil }^{b_1 -1} 2i -q +1 \\&\quad = \left\{ \begin{array}{ll} 0, &{}\quad \text{ if }~ b_1 \le \lceil q/2 \rceil , \\ (b_1 - q/2 )^2, &{}\quad \text{ if }~ q ~\text{ is } \text{ even } \text{ and }~b_1>\lceil q/2 \rceil ,\\ (b_1 - (q+1)/2)(b_1 - (q+1)/2 +1), &{}\quad \text{ if }~ q ~\text{ is } \text{ odd } \text{ and }~b_1>\lceil q/2 \rceil , \end{array} \right. \end{aligned}$$

which, in arbitrary characteristic, equals

$$\begin{aligned} \left( \max \left\{ 0,b_1 - \left\lceil \frac{q}{2} \right\rceil \right\} \right) \left( b_1 - \left\lfloor \frac{q}{2} \right\rfloor \right) . \end{aligned}$$
(2)

Let us now consider the case \(a_1 = b_1\). In this case, condition (i) is equivalent to \(a_0 \ge q-1 -b_1\), condition (ii) is equivalent to \(a_0 \le b_0\), and condition (iii) is equivalent to \(a_0 \ge b_1\). Summarizing, we have that

$$\begin{aligned} \max \{q-1 - b_1, b_1 \} \le a_0 \le b_0. \end{aligned}$$

Thus, for \(a_1=b_1\) the number of pairs that satisfy (i)–(iii) is

$$\begin{aligned} \max \{0, b_0 - \max \{q-1 - b_1, b_1 \} +1 \}.\end{aligned}$$
(3)

As mentioned, we have counted the number of cyclotomic cosets that are symmetric or SR-asymmetric, but we do not know yet their cardinality and how many of them are symmetric and SR-asymmetric. With respect to the number of symmetric cosets of cardinality one, we have that \(x = xq\) and \(n-x=x\), hence \((q^2-1)-x = x\) that implies that \(x= (q^2-1)/2\). Therefore, there is a unique symmetric coset with cardinality one, \(I_x\) with \(x= (q^2-1)/2\), if the characteristic of \({\mathbb {F}}_q\) is different from 2. Otherwise, there is no symmetric coset with cardinality one. Therefore, the number of symmetric cosets of cardinality one in \(\varDelta \) is

$$\begin{aligned} \left\{ \begin{array}{ll} 0, &{}\quad \text{ if }~ q ~\text{ is } \text{ even }\\ 1, &{}\quad \text{ if }~ q ~\text{ is } \text{ odd } \text{ and }~ m_t\ge (q^2-1)/2. \end{array} \right. \end{aligned}$$
(4)

We compute now the number of SR-asymmetric cosets that have cardinality one. For an asymmetric coset (FR or SR) with cardinality one, we have that \(x = xq\), hence \(x(q-1)\) is zero modulo \(q^2-1\), and this implies that x is a multiple of \((q+1)\). Therefore, the number of asymmetric cosets with cardinality one is \(\lfloor (m_t)/(q+1) \rfloor \). However, we are interested in the number of SR-asymmetric cosets with cardinality one. To compute it, we should subtract the number of FR-asymmetric cosets with cardinality one. Actually, among the \(q-2\) multiples of \(q+1\) (we recall that we do not consider 0) the first half are minimal representatives of FR-asymmetric cosets and the second half are the minimal representatives of SR-asymmetric cosets. Thus, if the characteristic of \({\mathbb {F}}_q\) is even, there are \((q-2)/2\) FR-symmetric cosets with cardinality one. If the characteristic of \({\mathbb {F}}_q\) is odd, we should take into account that the coset \(\{(q^2-1)/2\}\) is the only symmetric coset with cardinality one. Hence, there are \((q-3)/2 +1\) FR-asymmetric cosets with cardinality one. Therefore, for arbitrary characteristic, the number of SR-asymmetric cosets with cardinality one in \(\varDelta \) is

$$\begin{aligned} \max \left\{ 0, \left\lfloor \frac{m_t}{q+1} \right\rfloor - \left\lfloor \frac{q-1}{2} \right\rfloor \right\} .\end{aligned}$$
(5)

Finally, we compute the number of symmetric cosets with cardinality 2. In this case, \(n - xq = x\), hence \(n=x(q+1)\) and therefore x is a multiple of \(q-1\). Since we are not considering 0, there are q possible multiples. However, not all of them are minimal representatives, and only a half of them will be minimal representatives of a coset. Hence, the number of symmetric cosets with cardinality 2 in \(\varDelta \) is

$$\begin{aligned} \min \left\{ \left\lfloor \frac{m_t}{q-1} \right\rfloor , \left\lfloor \frac{q}{2} \right\rfloor \right\} .\end{aligned}$$
(6)

Thus, we are ready to state and prove the main result in this section.

Theorem 11

Consider the BCH code \(E_\varDelta \) over the field \({\mathbb {F}}_q\) with extension degree 2 and length \(q^2-1\) given by \(\varDelta = \Delta (t) = \cup _{j=0}^t I_{m_j} \subseteq {\mathcal {H}}\). Set \(b_0 + b_1t\) the q-adic expression of \(m_t\). Then, the parameters of the corresponding EAQECC are

$$\begin{aligned} \left[ \left[ q^2-1,q^2-1-2\sum _{j=0}^{t} i_{m_j}+c,\ge m_{t+1}+1;c\right] \right] _q, \end{aligned}$$

where c is equal to

$$\begin{aligned} c= & {} 1+ 4 \left( \frac{b_1(b_1+1)}{2}-\left( \max \left\{ 0,b_1 - \left\lceil \frac{q}{2} \right\rceil \right\} \right) \left( b_1 - \left\lfloor \frac{q}{2} \right\rfloor \right) \right. \\&\left. + \max \{0, b_0 - \max \{q-1 - b_1, b_1 \} +1 \} \right) \\&- 3\delta -2 \left( \max \left\{ 0, \left\lfloor \frac{m_t}{q+1} \right\rfloor - \left\lfloor \frac{q-1}{2} \right\rfloor \right\} \right) -2 \left( \min \left\{ \left\lfloor \frac{m_t}{q-1} \right\rfloor , \left\lfloor \frac{q}{2} \right\rfloor \right\} \right) , \end{aligned}$$

and where \(\delta \) is equal to 1 if q is odd and \(m_t\ge (q^2-1)/2\), and it is equal to 0 otherwise.

Proof

By Remark 5, we have that c is equal to the sum of the cardinality of the symmetric cosets in \(\varDelta \) plus two times the cardinality of the SR-asymmetric cosets in \(\varDelta \).

The coset \(I_0 = \{0\}\) is symmetric and it always contributes with 1 to the value of c. Consider the above referenced values from (1) to (6). Then, (1)−(2)\(+\)(3) are the number of symmetric and SR-asymmetric cosets in \(\varDelta \). If they were all SR-asymmetric cosets with cardinality 2, they would contribute with 4 times (1)−(2)\(+\)(3) to the value c. However, this may not be the case and we should adjust the previous computation.

Note that a coset with cardinality one contributes 1 to c if it is symmetric and it contributes 2 to c if it is SR-asymmetric. Finally, a coset with cardinality 2 that is symmetric contributes 2 to c.

Therefore,

$$\begin{aligned} c= 1+ 4 \times ((1)-(2)+(3)) -3\times (4)-2\times (5)-2\times (6), \end{aligned}$$

and the result holds. \(\square \)

If one constructs the above codes as described in Sect. 2 but with the ideal J generated by \(X^{n+1} -X\) instead of \(X^{n} -1\), a very similar argument proves the following result.

Theorem 12

Consider the BCH code \(E_\varDelta \) over the field \({\mathbb {F}}_q\) with extension degree 2 and length \(q^2\) given by \(\varDelta = \Delta (t) = \cup _{j=0}^t I_{m_j} \subseteq {\mathcal {H}}\). Set \(b_0 + b_1t\) the q-adic expression of \(m_t\). Then, the parameters of the corresponding EAQECC are

$$\begin{aligned} \left[ \left[ q^2,q^2-2\sum _{j=0}^{t} i_{m_j} +c,\ge m_{t+1}+1;c\right] \right] _q, \end{aligned}$$

where c is equal to

$$\begin{aligned} c= & {} 4 \left( \frac{b_1(b_1+1)}{2}-\left( \max \left\{ 0,b_1 - \left\lceil \frac{q}{2} \right\rceil \right\} \right) \left( b_1 - \left\lfloor \frac{q}{2} \right\rfloor \right) \right. \\&\left. {+} \max \{0, b_0 - \max \{q-1 - b_1, b_1 \} +1 \} \right) \\&-3\delta -2 \left( \max \left\{ 0, \left\lfloor \frac{m_t}{q+1} \right\rfloor - \left\lfloor \frac{q-1}{2} \right\rfloor \right\} \right) -2 \left( \min \left\{ \left\lfloor \frac{m_t}{q-1} \right\rfloor , \left\lfloor \frac{q}{2} \right\rfloor \right\} \right) , \end{aligned}$$

and where \(\delta \) is equal to 1 if q is odd and \(m_t\ge (q^2-1)/2\), and it is equal to 0 otherwise.

Note that considering an RS code over the finite field with \(q^2\) elements and the Hermitian metric produces an EAQECC with better parameters than the corresponding one obtained with a BCH over the field with q elements and the Euclidean metric, because both have the same length and bound for the minimum distance and the dimension is larger for the RS code with the Hermitian metric. However, we notice that it is possible to obtain a BCH code with a higher value for c, which increases the constellation of known EAQECCs.

6 Hermitian BCH EAQECC with extension degree 2

We consider now BCH codes over \({\mathbb {F}}_{q^2}\) and the Hermitian inner product to construct EAQECCs. Set \(\ell = 2r\) and \(n= q^4 -1\) in this section. Thus, the cyclotomic coset with minimal representative x is equal to \(I_x = \{x, q^2 x \}\), and the reciprocal cyclotomic coset of \(I_x\) is equal to \(I_{n-qx}\).

We can again characterize symmetric cosets and SR-asymmetric cosets in \(\varDelta =\Delta (t) = \cup _{j=0}^{t} I_{m_j}\), but such a characterization is not as precise as for the Euclidean case for cosets with cardinality 2. Let x be the minimal representative of \(I_x\) with cardinality 2. In the Euclidean case, we have that \(n-qx\) is the minimal representative of its reciprocal coset \(I_{n-x}\). However, in the Hermitian case the reciprocal coset of \(I_x\) is \(I_{n-qx}= \{n-qx, n-q^3 x \}\) and we do not know a priori which is its minimal representative because any one of them can be the smallest element modulo \(q^4-1\).

Let \((a_0,a_1,a_2,a_3)\) be the q-adic expansion of x, i.e., \(x=a_0+a_1q+a_2q^2+a_3 q^3\), with \(0 \le a_i < q\) for \(0 \le i \le 3\). We denote in this section by x the 4-tuple \((a_0,a_1,a_2,a_3)\) as well. Note that \(y=q^2x\) has q-adic expansion \((a_2,a_3,a_0,a_1)\). We begin by studying the cosets with cardinality one since they can be easily characterized.

Lemma 13

\(I_{x} = \{x\}\) holds if and only if \((q^2 +1) \mid x\). Moreover, \(I_x\) has cardinality 1 if and only if the q-adic expansion of x is of the form (abab), with \(0\le a,b <q\).

Proof

\(I_{x}=\{x\}\) if and only if \(x=q^2 x\). That is, \(x(q^2-1) =0\) modulo \(n=q^4-1\). Let \(x=(a_0,a_1,a_2,a_3)\), since \(I_x=\{x\}\) we have that \(x= q^2x\) and \(q^2(a_0,a_1,a_2,a_3)=(a_2,a_3,a_0,a_1)\). Therefore, \((a_0,a_1,a_2,a_3)=(a_2,a_3,a_0,a_1)\) and the result holds. \(\square \)

Next, we characterize symmetric and SR-asymmetric cosets with cardinality one.

Lemma 14

Let \(x = (a_0,a_1,a_2,a_3)\) with \(I_x=\{x\}\), then

  • \(I_x\) is a symmetric coset if and only if \(a_2 + a_3 = q-1\).

  • \(I_x\) is an SR-asymmetric coset if and only if \(a_2 + a_3 > q-1\).

Proof

Since \(I_x= \{x\}\), one has that \(I_x\) is symmetric if \(n-qx=x\), that is, if

$$\begin{aligned} (q-1,q-1,q-1,q-1)-(a_3,a_2,a_3,a_2) = (a_2,a_3,a_2,a_3), \end{aligned}$$

which is equivalent to \(a_2 + a_3 = q-1\). Analogously, \(I_x\) is an SR-asymmetric coset if \(n-qx<x\), that is, if

$$\begin{aligned} (q-1,q-1,q-1,q-1)-(a_3,a_2,a_3,a_2) < (a_2,a_3,a_2,a_3), \end{aligned}$$

which is equivalent to \(a_2 + a_3 > q-1\). \(\square \)

Thus, we have completely characterized the cosets with cardinality one. We consider now cosets with cardinality two. As we have mentioned before, its study will be more elaborated and complicated, although we have some positive news described in the following result.

Lemma 15

There is no symmetric coset with cardinality 2 in the Hermitian case.

Proof

Let \(I_x\) be with cardinality 2 and symmetric, then \(n-qx = q^2 x\) or \(n -qx = x\). Let us show, by contradiction, that these equalities do not hold. If \(n-qx = q^2 x\), then \(q^4-1 = q(q-1)x\) which implies that q divides \(q^4-1\), contradiction.

If \(n-qx = x\), then \(n = (q+1)x\). This implies that \(x= (q-1)(q^2 +1) = -1 +q -q^2 + q^3 = (q-1,0,q-1,0)\) and, by Lemma 13, \(I_x\) has cardinality 1, contradiction. \(\square \)

Hence, among the cosets with cardinality two, we should only count SR-asymmetric cosets.

Lemma 16

Let \(I_x\) be with cardinality 2 and such that x is its minimal representative. Then, \(I_x\) is an SR-asymmetric coset if and only if there exists \(z \in I_x\) such that \(n-qz < x\).

Proof

Let \(I_x = \{x, y\}\). Note that the minimal representative of the reciprocal cyclotomic coset of \(I_x\) is \(n-qx\) or \(n-qy\) and the result follows as in Lemma 9. \(\square \)

The following result is used to characterize which element is the minimal representative of the reciprocal coset of a coset with two elements.

Lemma 17

Let \(I_x=\{x,y\}\) be with cardinality 2 and such that \(x=(a_0,a_1,a_2,a_3)\) is its minimal representative. One has that:

  • \(qx>qy\) if and only if \(a_2>a_0\) or \(a_2=a_0\) and \(a_1>a_3\).

  • \(qx<qy\) if and only if \(a_2<a_0\) or \(a_2=a_0\) and \(a_1<a_3\).

Proof

We have that \(qx=(a_3,a_0,a_1,a_2)\) and \(qy=(a_1,a_2,a_3,a_0)\). We prove the case \( qx>qy\), because the case \(qx<qy\) is analogous. The inequality \(qx>qy\) holds if and only if \((a_3,a_0,a_1,a_2)\) is greater than \((a_1,a_2,a_3,a_0)\) with respect to the lexicographical ordering. That is, if \(a_2 >a_0\) or if \(a_2 = a_0\) and \(a_1 > a_3\). Note that since \(qx \ne qy\), we cannot have that \(a_2 = a_0\) and \(a_1 = a_3\) and the result holds. \(\square \)

Next, we characterize the cyclotomic cosets with two elements that are SR-asymmetric cosets.

Lemma 18

Let \(I_x=\{x,y\}\) with cardinality 2, where \(x=(a_0,a_1,a_2,a_3)\) is its minimal representative. Then, \(I_x\) is an SR-asymmetric coset if and only if

  • either \(a_2+a_3 > q-1\), or \(a_2+a_3=q-1\) and \(a_1+a_2>q-1\), if \(qx>qy\),

  • either \(a_0+a_3 > q-1\), or \(a_0+a_3=q-1\) and \(a_3+a_2>q-1\), if \(qx<qy\).

Proof

Let us assume that \(qx >qy\), the case \(qx < qy\) follows analogously. In this case, the minimal representative of \(I_{n-qx}\) is \(n-qx\). We should compute when \(n-qx \le x\), that is, when \((q-1,q-1,q-1,q-1)-(a_3,a_0,a_1,a_2) \le (a_0,a_1,a_2,a_3)\), since \(n=(q-1,q-1,q-1,q-1)\). That is,

$$\begin{aligned}&(q-1,q-1,q-1,q-1) \nonumber \\&\quad \le (a_3 + a_0)+ (a_0 + a_1)q + (a_1 + a_2)q^2 + (a_2+ a_3)q^3. \end{aligned}$$
(7)

We claim that (7) holds if \(a_2 + a_3 > q-1\), or if \(a_2 + a_3 = q-1\) and \(a_1 + a_2 > q-1\). Equivalently, we are claiming that if \(a_2 + a_3 = q-1\) and \(a_1 + a_2 = q-1\), then Inequality (7) does not hold. Indeed, in that case we would have that \(a_1 = a_3\) and, by Lemma 17, \(a_2 > a_0\) (since \(qx > qy\)). As a consequence, (7) is not true since \(a_0 + a_1 < a_2 + a_1 = q-1\).\(\square \)

The following definition is a key concept to study cosets with cardinality 2.

Definition 19

We define an interlude as the set of natural numbers that are between two consecutive cosets of cardinality one and that are minimal representatives of a coset with cardinality 2. By Lemma 13, the cyclotomic cosets of cardinality 1 are of the form \(\{(a,b,a,b)\}\), with \(0\le a,b <q\). Hence, an interlude is formed by integers x of the form

$$\begin{aligned} (a,b,a,b)<x<(a+1,b,a+1,b), ~\text{ with }~ 0 \le a<q-1\quad \text{ and }\quad 0\le b <q, \end{aligned}$$

or

$$\begin{aligned} (q-1,b,q-1,b)<x<(0,b+1,0,b+1) ~\text{ with }~ 0\le b \le q-2, \quad \text{ and }\quad x<q^2 x, \end{aligned}$$

to ensure that x is the minimal representative. We denote the interlude bounded by (abab) and \((a+1,b,a+1,b)\) by \([(a,b,a,b),(a+1,b,a+1,b)]_M\).

We now characterize the elements in an interlude. We will see that they are all consecutive which explains the name.

Lemma 20

Let \(0 \le a <q-1\) and \(0\le b <q\), then

$$\begin{aligned}&[(a,b,a,b),(a+1,b,a+1,b)]_M \\&\quad =\{ (i,j,a,b) : 0\le i< q \quad \text{ and }\quad b< j<q, ~\text{ or }~ a< i <q \quad \text{ and }\quad j=b\}. \end{aligned}$$

Let \(0\le b \le q-2\), then

$$\begin{aligned}&[(q-1,b,q-1,b), (0,b+1,0,b+1)]_M \\&\quad = \{ (i,j,q-1,b) : 0\le i< q \quad \text{ and }\quad b< j <q \}. \end{aligned}$$

Proof

Let us consider \((a,b,a,b)<x<(a+1,b,a+1,b)\), then x can be written in two different ways:

  1. (i)

    \(x=(i,j,a,b)\), with \(0 \le i <q\) and \(b<j <q\), or \(a< i <q\) and \(j=b\).

  2. (ii)

    \(x=(i,j,a+1,b)\), with \(0 \le i <q\) and \(0 \le j < b\), or \(0 \le i < a+1\) and \(j=b\).

We claim that all elements of the form described in (i) are minimal representatives, and thus they are in an interlude, and that all the elements in (ii) are not minimal representatives, and hence they are not in an interlude. Then, \(x=(i,j,a,b)\) is the minimal representative of its cyclotomic coset if \(x<q^2x\) and then \(q^2(i,j,a,b)=(a,b,i,j)>(i,j,a,b)\) if and only if \(b<j\) or \(j=b\) and \(a<i\). That is, we get all the elements in (i). Consider now \(x=(i,j,a+1,b)\), again x is the minimal representative of its coset if \(q^2 (i,j,a+1,b) = (a+1,b,i,j) > (i,j,a+1,b)\), which implies that \(b < j\), or that \(a+1 < i\) and \(b=j\). Note that these conditions are not satisfied by any element in (ii).

We consider now \((q-1,b,q-1,b)<x<(0,b+1,0,b+1)\), then x can be written in two different ways:

  1. (iii)

    \(x=(i,j,q-1,b)\), with \(0 \le i <q\) and \(b<j <q\).

  2. (iv)

    \(x=(i,j,0,b+1)\), with \(0 \le i <q\) and \(0 \le j < b +1\).

Again, we claim that the elements in (iii) are in an interlude and all the elements in (iv) are not. One has that \(x=(i,j,q-1,b)\) is the minimal representative of its cyclotomic coset if \(x<q^2x\) and then \(q^2(i,j,q-1,b)=(q-1,b,i,j)>(i,j,a,b)\) if and only if \(b<j\). That is, we obtain all the elements in (iii). Consider now \(x=(i,j,0,b+1)\), again x is the minimal representative of its coset if \(q^2 (i,j,0,b+1) = (0,b+1,i,j) > (i,j,0,b+1)\), which implies that \(b +1 < j\). This condition is not satisfied by any element in (iv), which concludes the proof. \(\square \)

Remark 21

Let \(I_x\) be with cardinality 2 and \(x=(a_0,a_1,a_2,a_3)\) its minimal representative, then x is in the interlude \([(a_2,a_3,a_2,a_3),(a_2+1,a_3,a_2+1,a_3)]_M\) if \(a_2 < q-1\), and in \([(q-1,a_3,q-1,a_3),(0,a_3+1,0,a_3+1)]_M\) if \(a_2 = q-1\).

FR-asymmetric cosets were described in [9, Theorem 3.11], where they were used to construct regular quantum codes:

Lemma 22

Let \(0< x< (q^4-1)/(q+1)\), then \(I_x\) is an FR-asymmetric coset and x is its minimal representative.

Next, we characterize the SR-asymmetric cyclotomic cosets whose minimal representative is in the interlude \([(q^4-1)/(q+1),q^3+q]_M\).

Lemma 23

Let x be the minimal representative of \(I_x\), a coset with cardinality 2, with \((q^4-1)/(q+1)< x < q^3+q\). Then, \(I_x\) is an SR-asymmetric coset. Furthermore, there are \(q^2-q\) minimal representatives of SR-asymmetric cosets in the interlude \([(q^4-1)/(q+1),q^3+q]_M\).

Proof

Note that \((q^4-1)/(q+1)=(q-1,0,q-1,0)\) and \(q^3+q=(0,1,0,1)\). By Lemma 20, an element x in \([(q^4-1)/(q+1),q^3+q]_M\) is given by \(x=(a_0,a_1,a_2,a_3)=(i,j,q-1,0)\), with \(0 \le i < q\) and \(0< j < q\). Hence, there are \(q(q-1)\) elements in the interlude that are minimal representatives of cosets, we claim that all these cosets are SR-asymmetric.

In fact, \(qx=(0,i,j,q-1)\) and \(qy=(j,q-1,0,i)\), where \(I_x = \{x,y\}\). Thus, \(qx > qy\) and by Lemma 17, it holds that \(a_2>a_0\) or \(a_2=a_0\) and \(a_1>a_3\). By Lemma 18, the result follows because \(a_2 + a_3 = q-1\) and \(a_1 + a_2 > q-1\) since \((q-1) + 0 = (q-1)\) and \(j + (q-1) > q-1\) (because \(j > 0\)). \(\square \)

Our aim in the following lemmas is to count the quantity of SR-asymmetric cosets in an arbitrary interlude. We divide our study in two cases, for \(a_2 + a_3 < q-1\) and \(a_2 + a_3 \ge q-1\). These results will be used when proving the main theorem.

Lemma 24

There are \(a_3 (q-a_3)\) minimal representatives of SR-asymmetric cosets with cardinality 2 in the interlude \([(a_2,a_3,a_2,a_3),(a_2+1,a_2,a_2+1,a_3)]_M\), with \(a_2 + a_3 < q-1\).

Proof

Let \(x \in [(a_2,a_3,a_2,a_3),(a_2+1,a_2,a_2+1,a_3)]_M\). By Lemma 20, \(x=(i,j,a_2,a_3)\), with \(0\le i < q\) and \(a_3< j <q\), or \( a_2< i <q\) and \(j=a_3\). Since \(a_2 + a_3 < q-1\), by Lemmas 15 and 18, we have that \(I_x\) is an SR-asymmetric coset with cardinality two if and only if \(qx < qy\). Therefore, we have that \(qx<qy\). By Lemma 18, \(I_x\) is an SR-asymmetric coset if \(i+a_3>q-1\) or if \(i+a_3=q-1\) and \(a_2+a_3>q-1\). Therefore, \(I_x\) is an SR-asymmetric coset if \(i + a_3 > q-1\) because we are assuming that \(a_2+a_3 < q-1\).

Let \(a_3< j< q\), then there are \(a_3\) possible values for those i such that \(i+a_3 > q-1\), since \(i<q\), namely \(q-1-a_3 + 1, q-1-a_3+2, \ldots , q-1\). We consider now the case \(j = a_3\), then there are also \(a_3\) values i satisfying \(i+a_3 > q-1\), but we have a stronger restriction: \(a_2<i <q\) in this case, however, the assumption \(a_2+a_3< q-1 \) implies that all possible values of i satisfy the restriction \(a_2<i <q\) as well. Summarizing, j can take \(q-a_3\) possible values and, for all of them, i may take \(a_3\) values. Hence, there are \((q-a_3)a_3\) SR-asymmetric cosets with cardinality 2 in the given interlude. \(\square \)

Lemma 25

There are \(q^2 - qa_3 - a_2 -1\) minimal representatives of SR-asymmetric cosets with cardinality 2 in the interlude \([(a_2,a_3,a_2,a_3),(a_2+1,a_2,a_2+1,a_3)]_M\), with \(a_2 + a_3 \ge q-1\), and in the interlude \([(q-1,a_3,q-1,a_3),(0,a_3+1,0,a_3+1)]_M\) (considering \(a_2=q-1\)). Actually, every cyclotomic coset generated by an element in these interludes is an SR-asymmetric coset.

Proof

We start by proving our first statement. Let \(x \in [(a_2,a_3,a_2,a_3),(a_2+1,a_2,a_2+1,a_3)]_M\). By Lemma 20, \(x=(i,j,a_2,a_3)\), with \(0\le i < q\) and \(a_3< j <q\), or \(a_2< i <q\) and \(j=a_3\). We consider first the case \(qx>qy\). If \(a_2 + a_3 > q-1\) then \(I_x\) is an SR-asymmetric coset by Lemma 18. If \(a_2 + a_3 = q-1\), \(I_x\) is an SR-asymmetric coset if \(j + a_2 > q-1\) by Lemma 18. Note that \(j + a_2 > q-1\) if and only if \(j > a_3\), by Lemma 20, since we are assuming that \(a_2 + a_3 = q-1\) in this case. We consider now the case \(qx<qy\). By Lemma 17, \(i >a_2\) since \(j \ge a_3\). Moreover, since we assume that \(a_2 + a_3 \ge q-1\) and \(i > a_2\), one has that \(i + a_3 > q-1\) and by Lemma 18, \(I_x\) is an SR-asymmetric coset. Finally, we determine how many minimal representatives of SR-asymmetric cosets are. For every j such that \(a_3< j < q\) we have q possible values for i (since \(0\le i < q\)), hence we have \((q-1-a_3)q\) minimal representatives. For \(a_3=j\), we have \(q-a_2-1\) minimal representatives and then the first statement of this result holds.

We prove now the second statement. Assume that x is in \([(q-1,a_3,q-1,a_3),(0,a_3+1,0,a_3+1)]_M\). By Lemma 20, \(x=(a_0,a_1,a_2,a_3)=(i,j,q-1,a_3)\), with \(0\le i < q\) and \(a_3< j <q\), and hence there are \(q(q-1-a_3)\) possible values for i and j. It remains to prove that \(I_x\) is an SR-asymmetric coset for all x. The case \(a_3=0\) follows from Lemma 23, hence we can assume that \(a_3>0\). Moreover, we have that \(qx>qy\) by Lemma 17, since \(a_2 = q-1 \le a_0\) and \(a_1 = j > a_3\). Therefore, \(I_x\) is an SR-asymmetric coset by Lemma 18, because \(a_2 + a_3 = q-1 + a_3 > q-1\) (since \(a_3 >0\)). \(\square \)

We can now prove the main result that gives the parameters of the EAQECCs we construct in the Hermitian case.

Theorem 26

Consider the BCH code \(E_\varDelta \) over the field \({\mathbb {F}}_{q^2}\) with extension degree 2 and length \(q^4-1\), where \(\varDelta = \Delta (t) = \cup _{j=0}^t I_{m_j} \subseteq {\mathcal {H}}\). Set \((b_0,b_1,b_2,b_3)\) the q-adic expression of \(m_t\). Then, considering the Hermitian inner product, the parameters of the corresponding EAQECC are

$$\begin{aligned} \left[ \left[ q^4-1,q^4-1-2\sum _{j=0}^{t} i_{m_j}+c,\ge m_{t+1}+1;c\right] \right] _q, \end{aligned}$$

where

  1. 1.

    If \(m_t<\frac{q^4-1}{q+1}\), then \(c=1\).

  2. 2.

    If \(\frac{q^4-1}{q+1}\le m_t <q^3+q\), then \(c=2+4\left( m_t - \frac{q^4-1}{q+1}\right) \).

  3. 3.

    If \(q^3+q\le m_t\), then

    $$\begin{aligned} c= & {} 1 + 4q(q-1) + b_3^2 + \max \{0,2(b_2+b_3-q+2)-1\} \\&{+} 4\left( \sum _{j=1}^{b_3-1} \left[ (q-1-j)(q-j)j + (j+1)(q^2 - qj -1) \right. \right. \\&\left. - \frac{(2(q-1)-j)(j+1)}{2} \right] \\&{+} \delta \left( b_2b_3(q-b_3)+ b_3(b_1-b_3)+\max \{0,b_0+b_3-q+1)\}\right) \\&\left. {+} (1-\delta )\left[ (q-1-b_3)b_3(q-b_3) + (b_2 + b_3 -q +1)((q^2-q b_3 -1) \right. \right. \\&\left. \left. - (b_2 + q -b_3 -2)/2) + (m_t- (b_2+b_3q+b_2q^3+b_3q^3)) \right] \right) ,\end{aligned}$$

    \(\delta \) being 1 if \(b_2 + b_3 <q-1\) and \(\delta = 0\) otherwise.

Proof

By Remark 5, we have that c is equal to the cardinality of the symmetric cosets in \(\varDelta \) plus two times the cardinality of the SR-asymmetric cosets in \(\varDelta \). Note that the symmetric cosets of cardinality 1 contribute 1 to c and the SR-asymmetric cosets of cardinality 1 contribute 2 to c. The SR-asymmetric cosets of cardinality 2 contribute 4 to c and that there are no symmetric cosets with cardinality 2 by Lemma 15.

We have that the coset \(I_0 = \{0\}\) is symmetric and it always contributes 1 to the value of c.

  1. 1.

    Let \(m_t<\frac{q^4-1}{q+1}\), then the results holds by Lemma 22.

  2. 2.

    Let \((q^4-1)/(q+1)\le m_t<q^3+q=(q^4-1)/(q+1)+q^2 +1\). By Lemma 13, the cyclotomic coset generated by \((q^4-1)/(q+1)\) has cardinality 1 and it is symmetric by Lemma 14. By Lemma 23, an element greater than \((q^4-1)/(q+1)\) and smaller than or equal to \(m_t\), that is a minimal representative of a cyclotomic coset, generates an SR-asymmetric coset. Hence, there are \(m_t - (q^4-1)/(q+1)\) SR-asymmetric cosets.

  3. 3.

    Let \(q^3+q \le m_t\), by Lemma 23 we have \(q(q-1)\) minimal representatives of SR-asymmetric cosets in the interlude \([(q^4-1)/(q+1),q^3+q]_M\), that together with the symmetric coset with one element of \((q^4-1)/(q+1)\) contribute

    $$\begin{aligned} 4q(q-1) +1 \end{aligned}$$

    to c.

We count first the symmetric and SR-asymmetric cosets with cardinality 1, that is \(I_x=\{x\}\) with \((i,j,i,j)=x\le m_t=(b_0,b_1,b_2,b_3)\). Note that \((q-1,0,q-1,0)\) has been already considered in part (2). By Lemma 14, we have that \(I_x\) is symmetric if \(i+j = q-1\) and that \(I_x\) is an SR-asymmetric coset if \(i+ j > q-1\).

  • Let \(1 \le j < b_3\), we have that \(I_x\) is symmetric for \(i=q-1-j\) and that is an SR-asymmetric coset for \( q- j \le i < q\). Hence, for \(1 \le j < b_3\), we have \(b_3 -1 \) symmetric cosets and \(\sum _{j=1}^{b_3-1} j = b_3(b_3 -1)/2\) SR-asymmetric cosets.

  • For the case \(j = b_3\), we should consider \((i,b_3,i,b_3) \le (b_0,b_1,b_2,b_3)\) that is equivalent to \(i \le b_2\) by Lemma 20. Moreover, one has that \(i+b_3 \ge q-1\). Hence, there are \(\max \{0,b_2+b_3-q+2\}\) possible values for i. Only one of them generates a symmetric coset and the others are SR-asymmetric cosets.

Hence, the cosets with cardinality one, excepting \((q^4-1)/(q+1)\), contribute

$$\begin{aligned}&b_3 -1 + b_3(b_3 -1) + \max \{0,2(b_2+b_3-q+2)-1\} \\&\quad =-1 + b_3^2 + \max \{0,2(b_2+b_3-q+2)-1\} \end{aligned}$$

to c.

Now, we focus on the rest of the SR-asymmetric cosets with cardinality 2. We first count the number of different interludes that are smaller than the interlude that contains \(m_t\) and then count the number of SR-asymmetric cosets in each interlude. By Remark 21, \(m_t=(b_0,b_1,b_2,b_3)\) is in the interlude \([(b_2,b_3,b_2,b_3),(b_2+1,b_3,b_2+1,b_3)]_M\) if \(b_2 < q-1\) and in \([(q-1,b_3,q-1,b_3),(0,b_3+1,0,b_3+1)]_M\) if \(b_2 = q-1\). Thus, the interludes that we should count are of the form \([(i,j,i,j),(i+1,j,i+1,j)]_M\) or \([(q-1,j,q-1,j),(0,j+1,0,j+1)]_M\) with \(0 \le i < q\) and \(0< j < b_3\), or \( 0 \le i < b_2\) and \(j = b_3\). We divide the study in two cases \(j < b_3\) and \(j=b_3\).

Let \(j < b_3\). We divide again the study in two cases, the first one where we can use Lemma 24 and the second one where we can use Lemma 25.

  • There are \(q-1-j\) interludes of type \([(i,j,i,j),(i+1,j,i+1,j)]_M\), with \(i+j<q-1\). By Lemma 24, they contain \((q-j)j\) SR-asymmetric cosets. Hence, the case \(j < b_3\) and \(i+j<q-1\) contributes

    $$\begin{aligned} 4\sum _{j=1}^{b_3 -1} (q-1-j)(q-j)j \end{aligned}$$

    to c.

  • We consider now the opposite case, \(i+j\ge q-1\), where we know that every minimal representative in the interlude is an SR-asymmetric coset by Lemma 25. Namely, there are \(q^2 - qj -i -1\) elements in the interlude with first element (ijij) with \(0<j<b_3\) and \(q-1-j \le i < q\). Therefore, we have in total

    $$\begin{aligned} \sum _{i=q-1-j}^{q-1} (q^2 - qj -i -1 )= (j+1)(q^2 - qj -1) - \sum _{i=q-1-j}^{q-1} i, \end{aligned}$$

    which means that the case \(j < b_3\) and \(i+j\ge q-1\) contributes

    $$\begin{aligned} 4\left( (j+1)(q^2 - qj -1) - \frac{(2(q-1)-j)(j+1)}{2}\right) \end{aligned}$$

    to c.

Let \(j = b_3\). As above, we divide the study in two cases.

  • We consider first the case \(b_2+b_3<q-1\). Note that there are \(b_2\) interludes of the form \([(i,j,i,j),(i+1,j,i+1,j)]_M\) with \(0 \le i <b_2\) and \(j=b_3\) that are smaller than \((b_2,b_3,b_2,b_3)\). Moreover, by Lemma 24, they contain \(b_3(q-b_3)\) minimal representatives.

    Furthermore, we should count how many elements in the interlude containing \(m_t\), \([(b_2,b_3,b_2,b_3), (b_2+1,b_3,b_2+1,b_3)]_M\) (recall Remark 21), are smaller than or equal to \(m_t\). In this interlude the elements are \((i,k,b_2,b_3)\) with \(0 \le i < q\) and \(b_3<k<q\), or \(b_2<i <q\) and \(k=b_3\).

    Those elements that are minimal representatives of an SR-asymmetric coset satisfy \(i+ b_3 > q-1\) by Lemma 18, because \(b_2+b_3<q-1\) (we have that \(qx >qy\) does not hold if \(b_2 + b_3 <q-1\)). Hence, combining both restrictions we have either \(q-b_3 \le i < q\) and \(b_3<k<q\) or \(\max \{b_2 + 1, q-b_3\} \le i <q\). Note that under the hypothesis that \(b_2 + b_3 < q-1\), we have that \(\max \{b_2 + 1, q-b_3\} = q-b_3\) holds. Hence, the restrictions for belonging to the interlude and generating an SR-asymmetric coset are either

    $$\begin{aligned} q-b_3 \le i< q \quad \text{ and }\quad b_3<k<q \end{aligned}$$

    or

    $$\begin{aligned} q-b_3 \le i <q. \end{aligned}$$

    Moreover, these elements are smaller than or equal to \(m_t\), that is, \(k < b_1\) or \(k=b_1\) and \(i \le b_0\). From these restrictions, we get (note that \(b_3 \le b_1\) by Lemma 20):

    $$\begin{aligned} q-b_3 \le i<q \quad \text{ and }\quad b_3<k <b_1, \end{aligned}$$

    or

    $$\begin{aligned} q-b_3 \le i \le b_0 \quad \text{ and }\quad k=b_1, \end{aligned}$$

    or

    $$\begin{aligned} q-b_3 \le i <q \quad \text{ and }\quad k=b_3. \end{aligned}$$

    Thus, the number of possible representatives of an SR-asymmetric coset is:

    $$\begin{aligned}&b_3(b_1-b_3-1) + \max \{0,b_0+b_3-q+1\} + b_3 \\&\quad =b_3(b_1 -b_3) + \max \{0,b_0+b_3-q+1\}. \end{aligned}$$

    Hence, this case contributes

    $$\begin{aligned} 4(b_2b_3(q-b_3)+ b_3(b_1-b_3)+\max \{0,b_0+b_3-q+1)\}) \end{aligned}$$

    to c.

  • We consider now the case \(b_2+b_3\ge q-1\). Note that there are \(b_2\) interludes of the form \([(i,j,i,j),(i+1,j,i+1,j)]_M\) with \(0 \le i <b_2\) and \(j=b_3\) whose elements are smaller than \((b_2,b_3,b_2,b_3)\). For \(0 \le i < q-1 -b_3\), we have that \(i + b_3 < q-1\), and by Lemma 24, they contain \(b_3(q-b_3)\) minimal representatives, which means that the first \(q-1-b_3\) interludes have a total of \((q-1-b_3)b_3(q-b_3)\) minimal representatives of SR-asymmetric cosets.

    For the remaining cosets, \(q-1-b_3 \le i < b_2\), we have that \(i + b_3 \ge q-1\) holds and thus we should consider Lemma 25. Every minimal representative of these interludes generates an SR-asymmetric coset and there are \(q^2-q b_3 -i-1\). Therefore, the number of minimal representatives in this case is

    $$\begin{aligned}&\sum _{i=q-1-b_3}^{b_2 -1} (q^2 -qb_3 -i -1) \\&\quad =(b_2 + b_3 -q +1)(q^2-q b_3 -1) - \sum _{i=q-1-b_3}^{b_2 -1} i \\&\quad =(b_2 + b_3 -q +1)(q^2-q b_3 -1) - (b_2 + q -b_3 -2)(b_2+b_3-q+1)/2. \end{aligned}$$

    Furthermore, we should count how many elements in the interlude that contains \(m_t\), \([(b_2,b_3,b_2,b_3), (b_2+1,b_3,b_2+1,b_3)]_M\), are smaller than or equal to \(m_t\). Since, by Lemma 25, all elements in the interlude of \(m_t\) are minimal representatives of an SR-asymmetric coset, we conclude that there are \(m_t- (b_2+b_3q+b_2q^3+b_3q^3)\) elements.

    Hence, this case contributes

    $$\begin{aligned}&(q-1-b_3)b_3(q-b_3) + (b_2 + b_3 -q +1)((q^2-q b_3 -1) \\&\quad - (b_2 + q -b_3 -2)/2) + (m_t- (b_2+b_3q+b_2q^3+b_3q^3)) \end{aligned}$$

    to c.

Summing all contributions to c, we get the formula given in the statement for this part (3). \(\square \)

As above, if the ideal J introduced in Sect. 2 is generated by \(X^{n+1}-X\), with a very similar proof to that of the previous theorem, the following result holds.

Theorem 27

Consider the BCH code \(E_\varDelta \) over the field \({\mathbb {F}}_{q^2}\) with extension degree 2 and length \(q^4\), where \(\varDelta = \Delta (t) = \cup _{j=0}^t I_{m_j} \subseteq {\mathcal {H}}\). Set \((b_0,b_1,b_2,b_3)\) the q-adic expression of \(m_t\). Then, the parameters of the corresponding EAQECC are

$$\begin{aligned} \left[ \left[ q^4,q^4-2\sum _{j=0}^{t} i_{m_j}+c,\ge m_{t+1}+1;c\right] \right] _q, \end{aligned}$$

where

  1. 1.

    If \(m_t<\frac{q^4-1}{q+1}\), then \(c=0\).

  2. 2.

    If \(\frac{q^4-1}{q+1}\le m_t <q^3+q\), then \(c=1+4\left( m_t - \frac{q^4-1}{q+1}\right) \).

  3. 3.

    If \(q^3+q\le m_t\), then

    $$\begin{aligned} c= & {} 4q(q-1) + b_3^2 + \max \{0,2(b_2+b_3-q+2)-1\} \\&{+} 4\left( \sum _{j=1}^{b_3-1} \left[ (q-1-j)(q-j)j + (j+1)(q^2 - qj -1) \right. \right. \\&\left. - \frac{(2(q-1)-j)(j+1)}{2} \right] \\&{+} \delta \left( b_2b_3(q-b_3)+ b_3(b_1-b_3)+\max \{0,b_0+b_3-q+1)\}\right) \\&\left. {+} (1-\delta )\left[ (q-1-b_3)b_3(q-b_3) + (b_2 + b_3 -q +1)((q^2-q b_3 -1)\right. \right. \\&\left. \left. - (b_2 + q -b_3 -2)/2) + (m_t- (b_2+b_3q+b_2q^3+b_3q^3)) \right] \right) ,\end{aligned}$$

    where \(\delta =1\) if \(b_2 + b_3 <q-1\) and \(\delta = 0\) otherwise.

This family of codes contains codes with good parameters. As a sample, to finish this section and the paper, we present several tables (Tables 123 and 4) containing parameters of codes obtained with our formulae, over different finite fields, that exceed the Gilbert–Varshamov (GV) bound for EAQECCs [11].

Table 1 Parameters of EAQECCs over \({\mathbb {F}}_3\)
Table 2 Parameters of EAQECCs over \({\mathbb {F}}_4\)
Table 3 Parameters of EAQECCs over \({\mathbb {F}}_5\)
Table 4 Parameters of EAQECCs over \({\mathbb {F}}_7\)

Most of the EAQECCs in the literature (see Sect. 1) are binary or q-ary with length smaller than or equal to \(q^2\). Hence, we cannot compare our codes with them. Other articles about BCH codes consider just concrete subfamilies. To the best of our knowledge, the only article with EAQECCs having the same length as ours is [25]. There, the authors provide a few codes with length \(q^4-1\). Indeed, for a given finite field \({\mathbb {F}}_q\), they give two codes, with parameters \([[q^4-1, q^4 -1 - 5, 3; 1]]_q\) and \([[q^4-1, q^4 -1 - 7, 4; 1]]_q\). These codes are constructed from almost MDS constacyclic codes using the Hartmann–Tzeng bound. We notice that those with minimum distance 3 are contained in the set of codes presented in this section but the ones with minimum distance 4 are not contained in the codes presented in this section, and have better parameters. Notice also that the cyclotomic cosets presented in this section are consecutive to bound the minimum distance with the BCH bound but the codes with minimum distance 4 in [25] are constructed from non-consecutive cyclotomic cosets.