Perfectness of a Hamming code (source code)

= Perfectness of a Hamming code

A Hamming code has $2^{2^r-r-1}$ words, and each radius-one Hamming ball contains $1+(2^r-1)=2^r$ vectors. Its minimum distance is three, so these balls are disjoint, and their total size is $2^{2^r-1}$. They therefore partition the ambient space, making the code perfect.