with $m$ parity bits, it can cover bits from $1$ up to $2^m - 1$. If we subtract out the parity bits, we are left with $2^m - m - 1$ bits which are used as data bits.
Parity Bits |
Total Bits |
Data Bits |
$m$ |
$2^m - 1$ |
$ k = 2^m - m - 1$ |
m parity bits can cover bits from $1$ up to $2^m - 1$.
$k = 16$
$16 = 2^m - m - 1$
with $m = 5$, 31 bits can be covered but with 4 parity bits only 15 bits can be covered.
So with 5 check bits receiver can detect and correct single-bit errors.
message = 1101 0011 0011 0101
message + check bits = p1 p2 1 p3 1 0 1 p4 0 0 1 1 0 0 1 p5 1 0 1 0 1
https://gateoverflow.in/239593/hamming-code