```python
import itertools as it 
from kanren import isvar, membero, var, run, eq
from kanren.core import success, fail, condeseq
from sympy.ntheory.generate import prime, isprime 

# xが素数かどうかを判定する
def check_prime(x): 
    if isvar(x): 
        return condeseq([eq(x, p)] for p in map(prime, it.count(1))) 
    else: 
        return success if isprime(x) else fail 

x = var() 

list_nums = (23, 4, 27, 17, 13, 10, 21, 29, 3, 32, 11, 19) 
print('List of primes in the list:') 
print(set(run(0, x, (membero, x, list_nums), (check_prime, x))))
```


```python
print('List of first 7 prime numbers:') 
print(run(7, x, (check_prime, x))) 
```

addf836a6036d606902ff3ed4061e507eafd1887
ipynb
Jupyter Notebook
artificial-intelligence-with-python-ja-master/Chapter 6/prime.ipynb
tryoutlab/python-ai-oreilly
111a0db4a9d5bf7ec4c07b1e9e357ed4fa225f28
Unlicense
artificial-intelligence-with-python-ja-master/Chapter 6/prime.ipynb
tryoutlab/python-ai-oreilly
111a0db4a9d5bf7ec4c07b1e9e357ed4fa225f28
Unlicense
artificial-intelligence-with-python-ja-master/Chapter 6/prime.ipynb
tryoutlab/python-ai-oreilly
111a0db4a9d5bf7ec4c07b1e9e357ed4fa225f28
Unlicense
Qwen/Qwen-72B
1. YES
2. YES