text:
```python
import sympy
```

```python
import tensorflow as tf
```

    2021-07-24 12:11:31.418536: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory
    2021-07-24 12:11:31.418577: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.

```python
%timeit list(sympy.primerange(1,100))
```

    64.9 µs ± 4.19 µs per loop (mean ± std. dev. of 7 runs, 10000 loops each)

```python
%timeit [p for p in sympy.primerange(1,100)]
```

    62.4 µs ± 892 ns per loop (mean ± std. dev. of 7 runs, 10000 loops each)

help(sympy.primerange)

```python
list(sympy.primerange(1,12))
```

    [2, 3, 5, 7, 11]

Since the paper seems to
- not only want the prime numbers
- but also `1`

we'd better start from `0` instead of from `1` (as `Chia-Yen Chiang` did).

```python
list(sympy.primerange(0,13))
```

    [2, 3, 5, 7, 11]

No!? But of course, `sympy` was right: `1` is not a prime.

Let's see how `sympy` think when it comes to negative prime numbers.

```python
list(sympy.primerange(-13,13))
```

    [2, 3, 5, 7, 11]

```python
list(sympy.primerange(2,2))
```

    []

```python
list(sympy.primerange(2, 3.14))
```

    [2, 3]

```python
def kernel_size_generator(k):
    """
    This is just a simple wrapper around sympy.primerange()
    which yields 1 and all the prime numbers up until < k
    """
    if not isinstance(k, int) and not isinstance(k, float):
        raise ValueError("input arg k should be either an int or a float")
    if k < 1:
        raise ValueError("input arg k should be >= 1")
    if k == 1:
        yield 1
    else:
        yield 1
        for p in sympy.primerange(2,k):
            yield p
```

```python
list(kernel_size_generator(13))
```

    [1, 2, 3, 5, 7, 11]

```python
list(kernel_size_generator(3.14))
```

    [1, 2, 3]

```python
list(kernel_size_generator(-10))
```

```python
list(kernel_size_generator("10"))
```

```python

```

ext: ipynb