Skip to main content

How many weights can a linear code have?


We study the combinatorial function L(kq),  the maximum number of nonzero weights a linear code of dimension k over \({\mathbb {F}}_q\) can have. We determine it completely for \(q=2,\) and for \(k=2,\) and provide upper and lower bounds in the general case when both k and q are \(\ge 3.\) A refinement L(nkq),  as well as nonlinear analogues N(Mq) and N(nMq),  are also introduced and studied.

This is a preview of subscription content, access via your institution.

Fig. 1
Fig. 2


  1. After submission of this article, a proof was found in [1].


  1. Alberson T., Neri A.: Maximum weight spectrum codes.

  2. Baker R.C., Harman G., Pintz J.: The difference between consecutive primes, II. Proc. Lond. Math. Soc. 83(3), 532–562 (2001).

    MathSciNet  Article  MATH  Google Scholar 

  3. Beth T., Jungnickel D., Lenz H.: Design theory. BI-Institut, Mannheim, Wien, Zurich (1985).

  4. Cohen G., Honkala I., Litsyn S., Solé P.: Long packing and covering codes. IEEE Trans. Inf. Theory 43, 1617–1619 (1997).

    MathSciNet  Article  MATH  Google Scholar 

  5. Delsarte P.: Four fundamentals parameters of a code and their combinatorial significance. Inf. Control 23, 407–438 (1973).

    MathSciNet  Article  MATH  Google Scholar 

  6. Enomoto H., Frankl P., Ito N., Nomura K.: Codes with given distances. Graph Comb. 3, 25–38 (1987).

    MathSciNet  Article  MATH  Google Scholar 

  7. Huffman W.C., Pless V.: Fundamentals of Error Correcting Codes. Cambridge University Press, Cambridge (2003).

    Book  MATH  Google Scholar 

  8. Accessed 28 Jan 2018

  9. Singer J.: A theorem in finite geometry and some applications to number theory. Trans. Am. Math Soc. 43, 377–385 (1938).

    MathSciNet  Article  MATH  Google Scholar 

Download references

Author information

Authors and Affiliations


Corresponding author

Correspondence to Minjia Shi.

Additional information

Communicated by J. Jedwab.

This research is supported by National Natural Science Foundation of China (61672036), Excellent Youth Foundation of Natural Science Foundation of Anhui Province (1808085J20), Technology Foundation for Selected Overseas Chinese Scholar, Ministry of Personnel of China (05015133) and Key projects of support program for outstanding young talents in Colleges and Universities (gxyqZD2016008).

Appendix: numerical examples

Appendix: numerical examples

We provide lower bounds on L(kq) by computing the number of weights in long random codes produced by the computer package Magma [8]. We give some numerical examples in Table 1 about the lower bound of Proposition 4.

Table 1 Proposition 4

When n is in the millions, we can find linear \([n,k]_q\)-codes that meet the upper bound in Proposition 2: see Table 2.

Table 2 \(n=6,000,000\)

Rights and permissions

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Shi, M., Zhu, H., Solé, P. et al. How many weights can a linear code have?. Des. Codes Cryptogr. 87, 87–95 (2019).

Download citation

  • Received:

  • Revised:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI:


  • Linear codes
  • Hamming weight
  • Perfect difference sets

Mathematics Subject Classification

  • 94B05
  • 05B10