Solution (source code)

= Solution

A <Hamming code> decoder succeeds on a seven-bit block exactly when there are zero or one errors. Its radius-one decoding regions are disjoint, so an error of weight at least two cannot decode back to the original codeword. Thus
$$
q=(1-p)^7+7p(1-p)^6=1-21p^2+O(p^3),\qquad
\boxed{Q=q^N\simeq(1-21p^2)^N\simeq e^{-21Np^2}}.
$$
Numerically $Q\approx0.97929$, so only about $1.0212$ transmissions are expected. Even accounting for seven rather than four bits per letter, expected bits sent are $7N/Q\approx7148$, compared with $4N/P\approx218830$. \b[The Hamming method is substantially better] under the stated error detection and independent retransmission assumptions.