In [1]:
import numpy as np

In [2]:
h1 = lambda x: 3 * x % 10
h2 = lambda x: (x + 7) % 10

In [3]:
S = [3, 4, 7, 9]
B = np.zeros(10)

In [4]:
for element in S:
    B[h1(element)] = 1
    B[h2(element)] = 1

In [5]:
B


Out[5]:
array([ 1.,  1.,  1.,  0.,  1.,  0.,  1.,  1.,  0.,  1.])

In [6]:
def test_new_element(element):
    if B[h1(element)] and B[h2(element)]:
        print('pass')
    else:
        print('discard')

In [7]:
test_new_element(2)


pass

In [8]:
test_new_element(5)


discard

In [13]:
(np.arange(100) % 4 + 1) * 5


Out[13]:
array([ 5, 10, 15, 20,  5, 10, 15, 20,  5, 10, 15, 20,  5, 10, 15, 20,  5,
       10, 15, 20,  5, 10, 15, 20,  5, 10, 15, 20,  5, 10, 15, 20,  5, 10,
       15, 20,  5, 10, 15, 20,  5, 10, 15, 20,  5, 10, 15, 20,  5, 10, 15,
       20,  5, 10, 15, 20,  5, 10, 15, 20,  5, 10, 15, 20,  5, 10, 15, 20,
        5, 10, 15, 20,  5, 10, 15, 20,  5, 10, 15, 20,  5, 10, 15, 20,  5,
       10, 15, 20,  5, 10, 15, 20,  5, 10, 15, 20,  5, 10, 15, 20])