Nearly perfect code[1][2]


An \((n,K,2t+1)\) binary code is nearly perfect if parameters \(n\), \(K\), and \(t\) are such that the Johnson bound \begin{align} \frac{{n \choose t}\left(\frac{n-t}{t+1}-\left\lfloor \frac{n-t}{t+1}\right\rfloor \right)}{\left\lfloor \frac{n}{t+1}\right\rfloor }+\sum_{j=0}^{t}{n \choose j}\leq2^{n}/K \end{align} becomes an equality ([3], Sec. 2.3.5; see also Ref. [4], Ch. 17). All nearly perfect binary codes are either perfect, or correspond to either punctured Preparata codes or one of the \(2^r-2,2^{2^r-2-r},3)\) codes for \(r\geq 3\) [5].

Similar definitions can be made for \(q\)-ary codes, but all nearly perfect \(q\)-ary codes must be perfect [6][7].




  • Golay code — The extended Golay code is nearly perfect.
  • Hamming code — Shortened Hamming codes \([2^r-2,2^r-r-2,3]\) are nearly perfect ([4], pg. 533).


J. M. Goethals and S. L. Snover, “Nearly perfect binary codes”, Discrete Mathematics 3, 65 (1972). DOI
N. V. Semakov, V. A. Zinov'ev, G. V. Zaitsev, “Uniformly Packed Codes”, Probl. Peredachi Inf., 7:1 (1971), 38–50; Problems Inform. Transmission, 7:1 (1971), 30–39
W. C. Huffman and V. Pless, Fundamentals of Error-correcting Codes (Cambridge University Press, 2003). DOI
F. J. MacWilliams and N. J. A. Sloane. The theory of error correcting codes. Elsevier, 1977.
Kauko Lindström. "The nonexistence of unknown nearly perfect binary codes." PhD diss., Turun yliopisto, 1975.
K. Lindstrom and M. J. Aaltonen, "The nonexistence of nearly perfect nonbinary codes for 1 =< e =< 10", Ann. Univ. Turku, Ser. A I, No. 172, 1976.
K. Lindström, “All nearly perfect codes are known”, Information and Control 35, 40 (1977). DOI

Zoo code information

Internal code ID: nearly_perfect

Your contribution is welcome!

on (edit & pull request)

edit on this site

Zoo Code ID: nearly_perfect

Cite as:
“Nearly perfect code”, The Error Correction Zoo (V. V. Albert & P. Faist, eds.), 2022.
@incollection{eczoo_nearly_perfect, title={Nearly perfect code}, booktitle={The Error Correction Zoo}, year={2022}, editor={Albert, Victor V. and Faist, Philippe}, url={} }
Share via:
Twitter |  | E-mail
Permanent link:

Cite as:

“Nearly perfect code”, The Error Correction Zoo (V. V. Albert & P. Faist, eds.), 2022.