Solution (source code)

= Solution

Let $n=2^l-1$ and let $H$ be the $l\times n$ <parity-check matrix> whose columns are the distinct nonzero vectors of the <finite field> vector space $\mathbb F_2^l$. The binary <Hamming code> is
$$
C=\ker H=\{x\in\mathbb F_2^n:Hx^T=0\}.
$$
A <perfect code> has <Hamming balls> of radius $t=\lfloor(d-1)/2\rfloor$ about its codewords partitioning the whole ambient space, where $d$ is its <minimum Hamming distance of a linear code>.

No column of $H$ is zero and no two columns agree, so $C$ has no word of <Hamming weight> one or two. Three suitable columns sum to zero, so $d=3$. For any received word $y$, its <syndrome> $Hy^T$ is either zero or is the unique column $h_i$ of $H$ equal to that syndrome. In the first case $y\in C$; in the second,
$$
H(y+e_i)^T=Hy^T+h_i=0,
$$
so $y$ is at <Hamming distance> one from a codeword. Uniqueness follows from $d=3$. Thus the radius-one balls partition $\mathbb F_2^n$, and the code is perfect.

For $l=3$, the <dual code> is the <binary simplex code> of length seven. Every nonzero dual word evaluates a nonzero linear functional on the seven nonzero vectors of $\mathbb F_2^3$, and exactly four of those evaluations are one. Hence every nonzero word of $C^\perp$ has weight
$$
\boxed{4}.
$$