Given N, B, and D: Find a set of N codewords (1 <= N <= 64), each of length B bits (1 <= B <= 8), such that each of the codewords is at least Hamming distance of D (1 <= D <= 7) away from each of the other codewords. The Hamming distance between a pair of codewords is the number of binary bits that differ in their binary notation. Consider the two codewords 0x554 and 0x234 and their differences (0x554 means the hexadecimal number with hex digits 5, 5, and 4):
0x554 = 0101 0101 0100
0x234 = 0010 0011 0100
Bit differences: xxx xx Since five bits were different, the Hamming distance is 5.
Example
input :- N=16 B=7 D=3
output :- 0 7 25 30 42 45 51 52 75 76 82 85 97 102 120 127
I can generate all codewords(binary string) of length B and try picking every subset of size N and see if it each number in the picked subset with other number in the subset is at least D hamming distance apart but this will require time nCk
(2**B) C N
which can be horrible in the worst case. How can I generate the numbers efficiently?