Skip to content
DeepForgeby svx
All problems
MediumInformation Theoryinfo-100

Hamming Bound Check

Problem

Check the sphere-packing (Hamming) bound for a binary code with parameters (n, k, d). With t = floor((d - 1) / 2), return True when the number of words in a radius-t sphere around a codeword, sum_{i=0}^{t} C(n, i), does not exceed the number of syndromes 2^(n - k).

Hint

Perfect codes such as Hamming(7,4) meet the bound with equality.

Test cases

case 1
in: [7,4,3]
expected: true
case 2
in: [4,2,3]
expected: false
case 3
in: [3,1,3]
expected: true
case 4
in: [7,3,4]
expected: true
case 5
in: [5,2,3]
expected: true
Starter codePython
import math
def hamming_bound_holds(n, k, d):
    # Your code here
    pass

5 test cases · run your code against them in the editor