```python
from sympy import *
from sympy.ntheory import legendre_symbol
from sympy.matrices import Matrix, zeros

import itertools

init_printing()
```


```python
H = Matrix([
        [0, 0, 0, 1, 1, 1, 1,],
        [0, 1, 1, 0, 0, 1, 1,],
        [1, 0, 1, 0, 1, 0, 1,]
    ])

H
```


```python
ns = [x.applyfunc(lambda i: i%2) for x in H.nullspace()]
ns
```


```python
codebook = [a*ns[0]+b*ns[1]+c*ns[2]+d*ns[3] for a, b, c, d in itertools.product([0,1], repeat=4)]
codebook =  [c.applyfunc(lambda i: i%2) for c in codebook]
codebook
```


```python
H*codebook[14]
```


```python
H.rref()
```


```python
x = Matrix(MatrixSymbol('x', 7,1))
x
```


```python
H*x
```


```python
solve(Eq(H*x, zeros(7,1)))
```


```python

```

e9a4b8076b4cfb1992daf37b61fbe7febfb24dd2
ipynb
Jupyter Notebook
hamming-codes.ipynb
massimo-nocentini/crypto-and-codes
82a23161e3f8728a74b25e107949137ede1cd0d2
MIT
hamming-codes.ipynb
massimo-nocentini/crypto-and-codes
82a23161e3f8728a74b25e107949137ede1cd0d2
MIT
hamming-codes.ipynb
massimo-nocentini/crypto-and-codes
82a23161e3f8728a74b25e107949137ede1cd0d2
MIT
Qwen/Qwen-72B
1. YES
2. YES