---
title: Quantum Quadratic Residue Codes Overview
url: https://www.emergentmind.com/topics/quantum-quadratic-residue-codes
type: topic
---

# Quantum Quadratic Residue Codes Overview

Searching arXiv for recent and foundational papers on quantum quadratic residue codes and closely related constructions.
Quantum quadratic residue codes are quantum stabilizer codes derived from the arithmetic and algebraic structure of classical quadratic residue codes. In the most precise recent usage, a quantum quadratic residue code is the image under \(\iota^{-1}\) of a Hermitian self-orthogonal expurgated quadratic residue code over \(\mathbb F_{d^2}\), yielding a one-logical-qudit stabilizer code of prime length \(p\) [2603.18560]. More broadly, the literature also uses quadratic residue structure to build cyclic stabilizer codes, quasi-cyclic stabilizer codes, quantum synchronizable codes, and asymmetric quantum codes, so the subject spans both a narrow Hermitian-stabilizer definition and a wider family of residue-based quantum constructions [1407.8249].

## 1. Classical quadratic-residue foundations

Let \(p\) be an odd prime, and let \(\mathcal Q,\mathcal N\subset \mathbb F_p^\times\) denote the nonzero quadratic residues and nonresidues modulo \(p\), with \(|\mathcal Q|=|\mathcal N|=(p-1)/2\). A standard expurgated quadratic residue code over \(\mathbb F_q\) has generator polynomial
\[
g(x)=(x-1)\prod_{s\in \mathcal Q}(x-\zeta^s),
\]
zero set \(\{0\}\cup \mathcal Q\), and parameters \(\left[p,\frac{p-1}{2}\right]_q\); the corresponding augmented and extended variants supply the standard odd-like/even-like QR trichotomy that underlies most quantum constructions [2603.18560].

For binary QR codes of prime length \(p\), the literature used in quantum constructions distinguishes the \([p,(p+1)/2]\) pair \(C_R,C_{NR}\) from the \([p,(p-1)/2]\) pair \(\bar C_R,\bar C_{NR}\), and exploits the square-root bound
\[
d\ge \sqrt p,
\]
with the refinement
\[
d^2-d+1\ge p
\]
when \(p\equiv -1\pmod 4\) [1403.6192]. In the asymmetric setting, the same QR data appear as \(Q,Q^\diamond,C,C^\diamond\), with
\[
Q,\ C:[p,(p+1)/2,d_1]_q,\qquad Q^\diamond,\ C^\diamond:[p,(p-1)/2,d_2]_q,
\]
and
\[
(d_1)^2\ge p,\qquad (d_2)^2\ge p
\]
[1302.5669].

A distinct but related classical object is the binary quasi-quadratic residue code
\[
C=\{(r_Qr_S,\ r_Nr_S)\mid S\subseteq \mathbb F_p\}\subseteq \mathbb F_2^{2p},
\]
which is self-dual of length \(2p\) and dimension \(p\) when \(p\equiv 3\pmod 4\) [1705.06413]. This terminology is a recurring source of ambiguity: in later quantum work, “QQR” refers to quantum quadratic residue codes, whereas in this classical literature it denotes quasi-quadratic residue codes.

## 2. Stabilizer realization and exact quantum definition

The most explicit modern definition takes a classical expurgated QR code \(C\subseteq \mathbb F_{d^2}^p\) and identifies \(\mathbb F_d^{2p}\) with \(\mathbb F_{d^2}^p\) through
\[
\iota(v_z,v_x)=v_z+\alpha v_x,
\]
where \(\alpha\in \mathbb F_{d^2}\setminus \mathbb F_d\). A quantum quadratic residue code on \(d\)-dimensional qudits is then the image under \(\iota^{-1}\) of a Hermitian self-orthogonal expurgated quadratic residue code over \(\mathbb F_{d^2}\) [2603.18560].

The Hermitian self-orthogonality criterion is
\[
C\subseteq C^{\perp_H}\quad\Longleftrightarrow\quad -r \text{ is a quadratic nonresidue mod } p,
\]
for \(q=r^2\). Specializing to \(q=d^2\), the existence condition becomes
\[
-d\in \mathcal N \pmod p.
\]
For qubits this is equivalent to \(p\equiv 5\) or \(7\pmod 8\); for qutrits it is equivalent to \(p\equiv 5\) or \(11\pmod{12}\). The corresponding stabilizer code has parameters
\[
[\![p,1,\delta_Q]\!]_d,
\]
with
\[
\delta_Q=\delta_C-1,\qquad \delta_Q\ge \lceil \sqrt p\rceil-1.
\]
Thus the recent QQR family is inherently a one-logical-qudit family with prime blocklength and classical distance inherited from expurgated QR codes [2603.18560].

This family is not uniformly CSS. It becomes CSS when the underlying expurgated QR code already exists over \(\mathbb F_d\), in which case
\[
\iota^{-1}(C)=D\times D
\]
for the corresponding expurgated QR code \(D\) over \(\mathbb F_d\). For qubits this occurs exactly when \(p\equiv 7\pmod 8\), and for qutrits exactly when \(p\equiv 11\pmod{12}\) [2603.18560].

## 3. Residue-based quantum code families beyond the narrow QQR definition

Quantum synchronizable codes form one important extension of the QR paradigm. Starting from cyclic codes \(C_2\subset C_1\) with \(C_1^\perp\subset C_2\), the synchronizable-code theorem yields
\[
(c_\ell,c_r)\text{-}[[\,n+c_\ell+c_r,\ 2k_2-n\,]]
\]
subject to
\[
c_\ell+c_r<\operatorname{ord}(f(x)),
\]
where \(g_2(x)=f(x)g_1(x)\). For binary QR codes of prime length \(p\equiv -1\pmod 8\), one has
\[
C_R^\perp=\bar C_R,\qquad C_{NR}^\perp=\bar C_{NR},
\]
hence dual-containment, and for Mersenne primes \(p=2^\ell-1\) the generator polynomial factors into \(\frac{2^{\ell-1}-1}{\ell}\) irreducible factors of degree \(\ell\). Deleting \(z\) such factors produces supercodes and a family
\[
(c_\ell,c_r)\text{-}[[\,p+c_\ell+c_r,\ 2z\ell+1\,]]
\]
with
\[
c_\ell+c_r<p,
\]
which attains the synchronization upper bound in that framework [1403.6192].

Asymmetric quantum codes arise from QR codes through expansion from \(\mathbb F_q\) to the prime field. For \(p\equiv 1\pmod 4\), the classical relation
\[
Q^\diamond=C^\perp
\]
gives \(C^\perp\subset Q\) and yields
\[
[[tp,t,d_z/d_x]]_\ell,\qquad d_z\ge \sqrt p,\quad d_x\ge \sqrt p.
\]
For \(p\equiv 3\pmod 4\), the dual-containing relation
\[
Q^\perp=Q^\diamond,\qquad Q^\perp\subset Q
\]
gives
\[
[[tp,t,d_z/d_x]]_\ell,\qquad d_z\ge d,\quad d_x\ge d,\quad d^2-d+1\ge p.
\]
In both families the unexpanded quantum dimension is \(1\), and expansion multiplies it to \(t\) [1302.5669].

A different construction starts directly from quadratic residue sets rather than from classical QR duality theorems. For primes \(p=4n\pm1\), the stabilizer matrix \(H=[H_1\mid H_2]\) is built so that
\[
H_1H_2^T+H_2H_1^T=\mathbf 0\pmod 2.
\]
The resulting Type-I family is cyclic of length \(N=p\), while Type-II is quasi-cyclic of length \(N=pk\) with \(k=(p-1)/2\). For \(p=4n+1\) and odd \(n\), the Type-I family gives
\[
[[p,1,d^\dagger\ge d_{min}\ge 3]],
\]
including
\[
[[5,1,3]],\ [[13,1,5]],\ [[29,1,11]],\ [[37,1,12]],\ [[53,1,15]],\ [[61,1,17]],\ [[101,1,21]].
\]
For \(p=4n-1\) and even \(n\), one gets high-rate cyclic codes
\[
[[4n-1,2n-1,2]].
\]
The Type-II quasi-cyclic constructions produce examples such as \([[10,1,3]]\), \([[21,5,5]]\), and \([[21,5,4]]\), with code dimension determined by rank formulas \(K=k-1\) or \(K=2k-1\) depending on the parity of \(n\) [1407.8249].

## 4. Representative parameter families and code equivalences

Several distinct QR-based quantum families coexist in the literature:

| Family | Main hypothesis | Quantum parameters |
|---|---|---|
| Hermitian QQR | \(-d\in\mathcal N\pmod p\) | \([\![p,1,\delta_Q]\!]_d\) |
| Synchronizable QR | \(p=2^\ell-1\), \(c_\ell+c_r<p\) | \((c_\ell,c_r)\text{-}[[p+c_\ell+c_r,2z\ell+1]]\) |
| Expanded AQECC from QR | \(q\) quadratic residue mod \(p\) | \([[tp,t,d_z/d_x]]_\ell\) |
| QR-set stabilizer codes | \(p=4n\pm1\) | cyclic \([[p,K,d]]\), QC \([[pk,K,d]]\) |

Within the recent Hermitian framework, the paper explicitly identifies several landmark distillation codes as quantum quadratic residue codes up to permutations of qudits and local Clifford equivalence. The length-\(5\) qubit QQR code is equivalent to the \([\![5,1,3]\!]_2\) perfect code, the length-\(7\) qubit QQR code is equivalent to the Steane code, the length-\(11\) qutrit QQR code is equivalent to the \(11\)-qutrit Golay code, and the length-\(23\) qubit QQR code is equivalent to the \(23\)-qubit Golay code [2603.18560].

The same work lists representative classical and quantum parameter pairs. For qubits:
\[
[5,2,4]_4\leftrightarrow [\![5,1,3]\!]_2,\quad
[7,3,4]_4\leftrightarrow [\![7,1,3]\!]_2,
\]
\[
[13,6,6]_4\leftrightarrow [\![13,1,5]\!]_2,\quad
[23,11,8]_4\leftrightarrow [\![23,1,7]\!]_2,
\]
\[
[29,14,12]_4\leftrightarrow [\![29,1,11]\!]_2,\quad
[53,26,16]_4\leftrightarrow [\![53,1,15]\!]_2.
\]
For qutrits:
\[
[5,2,4]_9\leftrightarrow [\![5,1,3]\!]_3,\quad
[11,5,6]_9\leftrightarrow [\![11,1,5]\!]_3,
\]
\[
[17,8,8]_9\leftrightarrow [\![17,1,7]\!]_3,\quad
[23,11,9]_9\leftrightarrow [\![23,1,8]\!]_3,
\]
\[
[41,20,14]_9\leftrightarrow [\![41,1,13]\!]_3.
\]
These examples exhibit the characteristic one-logical-qudit structure of the modern QQR family [2603.18560].

## 5. Magic-state distillation and current significance

Quantum quadratic residue codes acquired renewed prominence through magic-state distillation. In that setting, the family supplies \(n\)-to-1 stabilizer reductions for both qubit \(T\)-states and qutrit Strange states, and the recent synthesis argues that several of the most important known distillation protocols are unified by the QQR formalism [2603.18560].

For qubits, the reported QQR codes of lengths
\[
p=5,\ 23,\ 29,\ 47,\ 53,\ 71
\]
distill \(T\) states, with thresholds
\[
0.34535,\ 0.32237,\ 0.24190,\ 0.05050,\ 0.27343,\ 0.00664
\]
respectively. For qutrits, the reported QQR codes of lengths
\[
p=11,\ 17,\ 23,\ 41
\]
distill Strange states, with thresholds
\[
0.38715,\ 0.34394,\ 0.16636,\ 0.31877.
\]
The best thresholds in that study remain the \(5\)-qubit code for \(T\)-state distillation and the \(11\)-qutrit Golay/QQR code for Strange-state distillation [2603.18560].

The asymptotic result is particularly notable: if \(p\) is prime with
\[
p\equiv 5 \text{ or } 23 \pmod{24},
\]
then the corresponding qubit QQR code has a choice of sign \(\lambda\) such that
\[
\epsilon'(\epsilon)=O(\epsilon^2)\qquad (\epsilon\to 0),
\]
hence a nontrivial distillation threshold. By Dirichlet’s theorem, this yields infinitely many quantum quadratic residue codes that distill \(T\) states [2603.18560].

The technical reason QR structure is useful here is not only distance. The distillation analysis is reduced to classical weight enumerators, and for the qubit case the \(\mathbb F_4\)-linearity of the classical QR input aligns with a transversal \(M_3\) Clifford. Invariant-theoretic reconstruction of extended QR weight enumerators then becomes a practical tool for analyzing distillation performance [2603.18560].

## 6. Generalizations, terminology, and related directions

The QR paradigm extends beyond prime-length cyclic codes. Duadic group algebra codes are a generalization of quadratic residue codes, and they were shown to yield degenerate quantum stabilizer codes in which many errors of small weight do not need error correction [0701060]. More generally, \(m\)-adic residue codes over
\[
\mathbb F_q[v]/(v^s-v)
\]
admit dual-containing criteria and an orthogonality-preserving Gray map; from dual-containing odd-like class-I \(m\)-adic residue codes, one obtains quantum codes with parameters
\[
[[ps,\ ps-2k,\ d_G]]_q,
\]
where \(k=\sum_{i=0}^{s-1}\deg g_i(x)\) and \(d_G\) is the Gray distance [1810.11826]. Since quadratic residue codes correspond to \(m=2\), this places quantum QR constructions inside a broader residue-code hierarchy.

A second axis of generalization is ring lifting. Quadratic residue codes over \(\mathbb F_p[u]/\langle u^m-u\rangle\) admit Gray maps preserving self-duality; in the case \(q\equiv 3\pmod 4\), the even-like QR codes are self-orthogonal and the extended QR codes are self-dual after extension, with Gray images such as a self-orthogonal nearly MDS \([9,3,6]\) code over \(\mathbb F_7\) and a self-dual \([36,18,9]\) code over \(\mathbb F_5\) [1609.07862]. Over \(\mathbb Z_9+u\mathbb Z_9\), the decomposition
\[
C=uC_1+(1-u)C_2
\]
and a duality-preserving Gray map to \(\mathbb Z_9^{2n}\) yield self-orthogonal QR codes \(E_i\), self-dual extended QR codes \(\widehat{D_i}\) for \(p=12r-1\), and concrete self-dual \(\mathbb Z_9\)-codes with parameters \([22,11,5]\) and \([24,12,9]\) [1405.3347]. These are not quantum codes in themselves, but they supply classical self-orthogonal and dual-containing structures of the kind routinely used in stabilizer constructions.

A final source of ambiguity is terminological. “QQR code” may denote the classical quasi-quadratic residue code
\[
C=\{(r_Qr_S,\ r_Nr_S)\mid S\subseteq \mathbb F_p\},
\]
which is a binary self-dual code of length \(2p\) and dimension \(p\) for \(p\equiv 3\pmod 4\), with an extended code carrying an action of \(PSL_2(p)\) and a weight polynomial divisible by \((x^2+y^2)^{d-1}\) [1705.06413]. In the quantum literature, however, “quantum quadratic residue code” refers either to the Hermitian one-logical-qudit family over \(\mathbb F_{d^2}\) or, more loosely, to any stabilizer or CSS construction whose commutativity and distance properties are organized by quadratic residue sets [2603.18560]. The modern subject therefore combines a precise stabilizer definition with a wider algebraic design space shaped by residue/nonresidue arithmetic.

Source: https://www.emergentmind.com/topics/quantum-quadratic-residue-codes