# Is it possible to generate Hamming code with minimum distance $d$ which can correct more than 1 bit error?

In literature, all I am seeing is Hamming code with minimum Hamming distance $3$. Theoretically a Hamming code with minimum distance d can detect $d-1$ errors and can correct $(d-1)/2$ error. So minimum distance of $3$ can detect $2$ errors and correct $1$ error.

So here is my question: Is it possible to generate a code with minimum Hamming distance of (let's say) $5$ which can correct $2$-bit errors in each block of coded bits?

If not, then please give me an explanation.

• A Hamming code is defined as a single-error-correcting code with minimum Hamming distance exactly $3$ and maximal block length for the chosen number $m$ of parity bits. Its parameters (if you have seen the notation before) are $$[n,k,d] =[2^m-1,2^m-1-m,3].$$. So you cannot find "a _Hamming_ code with minimum distance $5$" as you want but you can find a code with minimum Hamming distance $5$ (notice the change in the location of the word "Hamming"). An easily-understood example can be found in Chapter 1 of Berkekamp's Algebraic Coding Theory (McGrawHill 1968, Aegean Press 1984). – Dilip Sarwate Jun 11 '18 at 13:48
• -1 for the use of $n$ in the title of your question to denote the minimum distance of the code. If your book or whatever material you are reading (including class notes that you have faithfully transcribed from what your instructor wrote on the board) uses $n$ for minimum distance, throw it away and find some other source/instructor. The use of $n$ to denote block length is universal in coding theory. – Dilip Sarwate Jun 11 '18 at 14:05
• Sorry for the mistake. I have edited it. Could you please remove -1? – Sourav Dev Jun 11 '18 at 17:15
• OK, removed the -1. Unfortunately, the answer by user36216 uses $n$ for the number ef parity bits (and is mostly wrong otherwise too). – Dilip Sarwate Jun 12 '18 at 2:24